From 4dd8bae5c91fa4aef09d865d8fef1acd84f90925 Mon Sep 17 00:00:00 2001 From: Wim Date: Sun, 17 Oct 2021 00:47:22 +0200 Subject: Update dependencies (#1610) * Update dependencies * Update module to go 1.17 --- .../mattermost/mattermost-server/v5/model/upload_session.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'vendor/github.com/mattermost/mattermost-server/v5/model/upload_session.go') diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/upload_session.go b/vendor/github.com/mattermost/mattermost-server/v5/model/upload_session.go index 663ee0b1..c5f09083 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/model/upload_session.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/model/upload_session.go @@ -18,6 +18,9 @@ const ( UploadTypeImport UploadType = "import" ) +// UploadNoUserID is a "fake" user id used by the API layer when in local mode. +const UploadNoUserID = "nouser" + // UploadSession contains information used to keep track of a file upload. type UploadSession struct { // The unique identifier for the session. @@ -29,7 +32,7 @@ type UploadSession struct { // The id of the user performing the upload. UserId string `json:"user_id"` // The id of the channel to upload to. - ChannelId string `json:"channel_id"` + ChannelId string `json:"channel_id,omitempty"` // The name of the file to upload. Filename string `json:"filename"` // The path where the file is stored. @@ -39,6 +42,10 @@ type UploadSession struct { // The amount of received data in bytes. If equal to FileSize it means the // upload has finished. FileOffset int64 `json:"file_offset"` + // Id of remote cluster if uploading for shared channel + RemoteId string `json:"remote_id"` + // Requested file id if uploading for shared channel + ReqFileId string `json:"req_file_id"` } // ToJson serializes the UploadSession into JSON and returns it as string. @@ -109,7 +116,7 @@ func (us *UploadSession) IsValid() *AppError { return NewAppError("UploadSession.IsValid", "model.upload_session.is_valid.type.app_error", nil, err.Error(), http.StatusBadRequest) } - if !IsValidId(us.UserId) { + if !IsValidId(us.UserId) && us.UserId != UploadNoUserID { return NewAppError("UploadSession.IsValid", "model.upload_session.is_valid.user_id.app_error", nil, "id="+us.Id, http.StatusBadRequest) } -- cgit v1.2.3