MM-31063: Change constants to use CamelCase (#16608)

* MM-31063: Change constants to use CamelCase

* store package

* change allcaps to camel case (#16615)

* New tools.mod

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Этот коммит содержится в:
Agniva De Sarker
2021-01-04 11:32:29 +05:30
коммит произвёл GitHub
родитель 8b6ac5f5d2
Коммит c1dd23a3c8
158 изменённых файлов: 1485 добавлений и 1479 удалений

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

@@ -22,13 +22,13 @@ import (
)
const (
FILE_TEAM_ID = "noteam"
FileTeamId = "noteam"
PREVIEW_IMAGE_TYPE = "image/jpeg"
THUMBNAIL_IMAGE_TYPE = "image/jpeg"
PreviewImageType = "image/jpeg"
ThumbnailImageType = "image/jpeg"
)
var UNSAFE_CONTENT_TYPES = [...]string{
var UnsafeContentTypes = [...]string{
"application/javascript",
"application/ecmascript",
"text/javascript",
@@ -37,7 +37,7 @@ var UNSAFE_CONTENT_TYPES = [...]string{
"text/html",
}
var MEDIA_CONTENT_TYPES = [...]string{
var MediaContentTypes = [...]string{
"image/jpeg",
"image/png",
"image/bmp",
@@ -169,7 +169,7 @@ func uploadFileSimple(c *Context, r *http.Request, timestamp time.Time) *model.F
auditRec.AddMeta("client_id", clientId)
info, appErr := c.App.UploadFileX(c.Params.ChannelId, c.Params.Filename, r.Body,
app.UploadFileSetTeamId(FILE_TEAM_ID),
app.UploadFileSetTeamId(FileTeamId),
app.UploadFileSetUserId(c.App.Session().UserId),
app.UploadFileSetTimestamp(timestamp),
app.UploadFileSetContentLength(r.ContentLength),
@@ -332,7 +332,7 @@ NEXT_PART:
auditRec.AddMeta("client_id", clientId)
info, appErr := c.App.UploadFileX(c.Params.ChannelId, filename, part,
app.UploadFileSetTeamId(FILE_TEAM_ID),
app.UploadFileSetTeamId(FileTeamId),
app.UploadFileSetUserId(c.App.Session().UserId),
app.UploadFileSetTimestamp(timestamp),
app.UploadFileSetContentLength(-1),
@@ -435,7 +435,7 @@ func uploadFileMultipartLegacy(c *Context, mr *multipart.Reader,
auditRec.AddMeta("client_id", clientId)
info, appErr := c.App.UploadFileX(c.Params.ChannelId, fileHeader.Filename, f,
app.UploadFileSetTeamId(FILE_TEAM_ID),
app.UploadFileSetTeamId(FileTeamId),
app.UploadFileSetUserId(c.App.Session().UserId),
app.UploadFileSetTimestamp(timestamp),
app.UploadFileSetContentLength(-1),
@@ -532,7 +532,7 @@ func getFileThumbnail(c *Context, w http.ResponseWriter, r *http.Request) {
}
defer fileReader.Close()
err = writeFileResponse(info.Name, THUMBNAIL_IMAGE_TYPE, 0, time.Unix(0, info.UpdateAt*int64(1000*1000)), *c.App.Config().ServiceSettings.WebserverMode, fileReader, forceDownload, w, r)
err = writeFileResponse(info.Name, ThumbnailImageType, 0, time.Unix(0, info.UpdateAt*int64(1000*1000)), *c.App.Config().ServiceSettings.WebserverMode, fileReader, forceDownload, w, r)
if err != nil {
c.Err = err
return
@@ -611,7 +611,7 @@ func getFilePreview(c *Context, w http.ResponseWriter, r *http.Request) {
}
defer fileReader.Close()
err = writeFileResponse(info.Name, PREVIEW_IMAGE_TYPE, 0, time.Unix(0, info.UpdateAt*int64(1000*1000)), *c.App.Config().ServiceSettings.WebserverMode, fileReader, forceDownload, w, r)
err = writeFileResponse(info.Name, PreviewImageType, 0, time.Unix(0, info.UpdateAt*int64(1000*1000)), *c.App.Config().ServiceSettings.WebserverMode, fileReader, forceDownload, w, r)
if err != nil {
c.Err = err
return
@@ -701,7 +701,7 @@ func writeFileResponse(filename string, contentType string, contentSize int64, l
if contentType == "" {
contentType = "application/octet-stream"
} else {
for _, unsafeContentType := range UNSAFE_CONTENT_TYPES {
for _, unsafeContentType := range UnsafeContentTypes {
if strings.HasPrefix(contentType, unsafeContentType) {
contentType = "text/plain"
break
@@ -717,7 +717,7 @@ func writeFileResponse(filename string, contentType string, contentSize int64, l
} else {
isMediaType := false
for _, mediaContentType := range MEDIA_CONTENT_TYPES {
for _, mediaContentType := range MediaContentTypes {
if strings.HasPrefix(contentType, mediaContentType) {
isMediaType = true
break