diff --git a/server/boards/api/files.go b/server/boards/api/files.go index 344933fc5d..4a7eb5e6e7 100644 --- a/server/boards/api/files.go +++ b/server/boards/api/files.go @@ -145,6 +145,12 @@ 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 := ""