diff options
author | Wim <wim@42.be> | 2021-10-17 00:47:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-17 00:47:22 +0200 |
commit | 4dd8bae5c91fa4aef09d865d8fef1acd84f90925 (patch) | |
tree | ffad9b242daccaf8c86d1c1fbd59032302bd3be9 /vendor/github.com/mattermost/mattermost-server/v5/model/upload_session.go | |
parent | 7ae45c42e712bd0e66c101f3f714c05aa1dc2104 (diff) | |
download | matterbridge-msglm-4dd8bae5c91fa4aef09d865d8fef1acd84f90925.tar.gz matterbridge-msglm-4dd8bae5c91fa4aef09d865d8fef1acd84f90925.tar.bz2 matterbridge-msglm-4dd8bae5c91fa4aef09d865d8fef1acd84f90925.zip |
Update dependencies (#1610)
* Update dependencies
* Update module to go 1.17
Diffstat (limited to 'vendor/github.com/mattermost/mattermost-server/v5/model/upload_session.go')
-rw-r--r-- | vendor/github.com/mattermost/mattermost-server/v5/model/upload_session.go | 11 |
1 files changed, 9 insertions, 2 deletions
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) } |