1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-21 13:38:56 +02:00

Used Shared resource from MM-server for attachment serving (#4542) (#4560)

* Used Shared resource for File Handling

* Making use of shared attachment serve functionality

* Added license

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
(cherry picked from commit c91a67fbe6)

Co-authored-by: Rajat Dabade <rajat.dabade@mattermost.com>
This commit is contained in:
Mattermost Build 2023-02-09 06:09:22 +02:00 committed by GitHub
parent cd4cbff43e
commit 11e8343b57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,6 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package api
import (
@ -17,6 +20,7 @@ import (
mmModel "github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
"github.com/mattermost/mattermost-server/v6/shared/web"
)
// FileUploadResponse is the response to a file upload
@ -166,7 +170,7 @@ func (a *API) handleServeFile(w http.ResponseWriter, r *http.Request) {
}
defer fileReader.Close()
http.ServeContent(w, r, filename, time.Now(), fileReader)
web.WriteFileResponse(filename, fileInfo.MimeType, fileInfo.Size, time.Now(), "", fileReader, false, w, r)
auditRec.Success()
}