[server] Fix validation for fileUpdate
This commit is contained in:
parent
9cb030124b
commit
74360f3c84
1 changed files with 5 additions and 2 deletions
|
@ -64,8 +64,11 @@ func (c *FileController) validateFileCreateOrUpdateReq(userID int64, file ente.F
|
|||
if !strings.HasPrefix(file.File.ObjectKey, objectPathPrefix) || !strings.HasPrefix(file.Thumbnail.ObjectKey, objectPathPrefix) {
|
||||
return stacktrace.Propagate(ente.ErrBadRequest, "Incorrect object key reported")
|
||||
}
|
||||
if file.EncryptedKey == "" || file.KeyDecryptionNonce == "" {
|
||||
return stacktrace.Propagate(ente.ErrBadRequest, "EncryptedKey and KeyDecryptionNonce are required")
|
||||
// Check for attributes for fileCreation. We don't send key details on update
|
||||
if file.ID == 0 {
|
||||
if file.EncryptedKey == "" || file.KeyDecryptionNonce == "" {
|
||||
return stacktrace.Propagate(ente.ErrBadRequest, "EncryptedKey and KeyDecryptionNonce are required")
|
||||
}
|
||||
}
|
||||
if file.File.DecryptionHeader == "" || file.Thumbnail.DecryptionHeader == "" {
|
||||
return stacktrace.Propagate(ente.ErrBadRequest, "DecryptionHeader for file & thumb is required")
|
||||
|
|
Loading…
Add table
Reference in a new issue