коммит произвёл
GitHub
родитель
6d54ed78dd
Коммит
7b164d4f82
@@ -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
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user