Moving file response functionality to shared folder (#22226)

* Moving file response functionality to shared folder

* Linter fixes

* Added the attachment serve to shared folder

* Removed the unwanted logs

* import fixes

* Linter fixes

* License added

* Moved UnsafeContentTypes and MediaContentTypes from api4

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Rajat Dabade
2023-02-09 08:39:42 +05:30
коммит произвёл GitHub
родитель 3ae70591d0
Коммит 825b281f36
6 изменённых файлов: 105 добавлений и 89 удалений

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

@@ -22,6 +22,7 @@ import (
"github.com/mattermost/mattermost-server/v6/services/cache"
"github.com/mattermost/mattermost-server/v6/services/upgrader"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
"github.com/mattermost/mattermost-server/v6/shared/web"
)
const (
@@ -122,7 +123,7 @@ func generateSupportPacket(c *Context, w http.ResponseWriter, r *http.Request) {
// Send the zip file back to client
// We are able to pass 0 for content size due to the fact that Golang's serveContent (https://golang.org/src/net/http/fs.go)
// already sets that for us
writeFileResponse(outputZipFilename, FileMime, 0, now, *c.App.Config().ServiceSettings.WebserverMode, fileBytesReader, true, w, r)
web.WriteFileResponse(outputZipFilename, FileMime, 0, now, *c.App.Config().ServiceSettings.WebserverMode, fileBytesReader, true, w, r)
}
func getSystemPing(c *Context, w http.ResponseWriter, r *http.Request) {