Boards: Avoid panic in Boards file request handler when file not found. (#22792)

* Avoid panic in Boards file request handler when file not found.
Этот коммит содержится в:
Doug Lauder
2023-04-03 12:27:16 -04:00
коммит произвёл GitHub
родитель 72cd7ac4e0
Коммит 69657be9f2

Просмотреть файл

@@ -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 := ""