diff --git a/ChangeLog.md b/ChangeLog.md index ff144413b..999bbb49c 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -4,6 +4,10 @@ ## Upcoming Release +Blob: + +- Fixed issue of: error code not matching Azure blob storage is returned when overwriting existing blobs with incorrect permissions + ## 2023.08 Version 3.26.0 General: diff --git a/src/blob/authentication/BlobSASAuthenticator.ts b/src/blob/authentication/BlobSASAuthenticator.ts index d61f43ce8..958a7b144 100644 --- a/src/blob/authentication/BlobSASAuthenticator.ts +++ b/src/blob/authentication/BlobSASAuthenticator.ts @@ -436,7 +436,7 @@ export default class BlobSASAuthenticator implements IAuthenticator { `BlobSASAuthenticator:validate() Account SAS validation failed for special requirement.`, context.contextId ); - throw StorageErrorFactory.getAuthorizationPermissionMismatch( + throw StorageErrorFactory.getUnauthorizedBlobOverwrite( context.contextId! ); } diff --git a/src/blob/errors/StorageErrorFactory.ts b/src/blob/errors/StorageErrorFactory.ts index 022e7067a..03b88cfaa 100644 --- a/src/blob/errors/StorageErrorFactory.ts +++ b/src/blob/errors/StorageErrorFactory.ts @@ -529,6 +529,17 @@ export default class StorageErrorFactory { ); } + public static getUnauthorizedBlobOverwrite( + contextID: string + ): StorageError { + return new StorageError( + 403, + "UnauthorizedBlobOverwrite", + "This request is not authorized to perform blob overwrites.", + contextID + ); + } + public static getAuthorizationServiceMismatch( contextID: string ): StorageError {