* Fix MM-53948

* Fix tests

* Fix missing layers
Этот коммит содержится в:
Daniel Espino García
2023-08-16 16:17:52 +02:00
коммит произвёл GitHub
родитель 6d54ed78dd
Коммит 7b164d4f82
5 изменённых файлов: 89 добавлений и 3 удалений

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

@@ -555,13 +555,27 @@ func GeneratePublicLinkHash(fileID, salt string) string {
// UploadFile uploads a single file in form of a completely constructed byte array for a channel.
func (a *App) UploadFile(c request.CTX, data []byte, channelID string, filename string) (*model.FileInfo, *model.AppError) {
return a.UploadFileForUserAndTeam(c, data, channelID, filename, "", "")
}
func (a *App) UploadFileForUserAndTeam(c request.CTX, data []byte, channelID string, filename string, rawUserId string, rawTeamId string) (*model.FileInfo, *model.AppError) {
_, err := a.GetChannel(c, channelID)
if err != nil && channelID != "" {
return nil, model.NewAppError("UploadFile", "api.file.upload_file.incorrect_channelId.app_error",
map[string]any{"channelId": channelID}, "", http.StatusBadRequest)
}
info, _, appError := a.DoUploadFileExpectModification(c, time.Now(), "noteam", channelID, "nouser", filename, data)
userId := rawUserId
if userId == "" {
userId = "nouser"
}
teamId := rawTeamId
if teamId == "" {
teamId = "noteam"
}
info, _, appError := a.DoUploadFileExpectModification(c, time.Now(), teamId, channelID, userId, filename, data)
if appError != nil {
return nil, appError
}