mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-24 13:43:12 +02:00
Avoid panic in file request handler on error (#4693)
Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
parent
99d2dc66e3
commit
50872269b3
@ -19,6 +19,7 @@ import (
|
||||
"github.com/mattermost/focalboard/server/model"
|
||||
|
||||
"github.com/mattermost/focalboard/server/services/audit"
|
||||
|
||||
mmModel "github.com/mattermost/mattermost-server/v6/model"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v6/shared/mlog"
|
||||
@ -167,7 +168,14 @@ func (a *API) handleServeFile(w http.ResponseWriter, r *http.Request) {
|
||||
_ = a.app.MoveFile(board.ChannelID, board.TeamID, boardID, filename)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
// if err is still not nil then it is an error other than `not found` so we must
|
||||
// return the error to the requestor. fileReader and Fileinfo are nil in this case.
|
||||
a.errorResponse(w, r, err)
|
||||
}
|
||||
|
||||
defer fileReader.Close()
|
||||
|
||||
mimeType := ""
|
||||
var fileSize int64
|
||||
if fileInfo != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user