diff --git a/i18n/en-US.properties b/i18n/en-US.properties
index d4c6296ce7..d2bc7021a1 100644
--- a/i18n/en-US.properties
+++ b/i18n/en-US.properties
@@ -912,6 +912,8 @@ be.uploadsFileSizeLimitExceededErrorMessage = File size exceeds the folder owner
be.uploadsFileSizeLimitExceededErrorMessageForUpgradeCta = This file exceeds your plan’s upload limit. Upgrade now to store larger files.
# Upgrade message shown when file size exceeds the limit
be.uploadsFileSizeLimitExceededUpgradeMessageForUpgradeCta = Upgrade
+# Error message shown when the user lacks permission to upload to the destination folder
+be.uploadsInsufficientPermissionsErrorMessage = You don't have permission to upload to this folder
# Error message shown when attempting to upload a file which name already exists
be.uploadsItemNameInUseErrorMessage = A file with this name already exists.
# Text shown when uploads are completed
diff --git a/src/api/uploads/MultiputUpload.js b/src/api/uploads/MultiputUpload.js
index 2e8b70b84c..40aa8c9542 100644
--- a/src/api/uploads/MultiputUpload.js
+++ b/src/api/uploads/MultiputUpload.js
@@ -15,6 +15,7 @@ import Browser from '../../utils/Browser';
import { updateQueryParameters } from '../../utils/url';
import {
DEFAULT_RETRY_DELAY_MS,
+ ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS,
ERROR_CODE_UPLOAD_STORAGE_LIMIT_EXCEEDED,
HTTP_STATUS_CODE_FORBIDDEN,
MS_IN_S,
@@ -341,7 +342,7 @@ class MultiputUpload extends BaseMultiput {
errorData.status === HTTP_STATUS_CODE_FORBIDDEN &&
errorData.code === ERROR_CODE_UPLOAD_STORAGE_LIMIT_EXCEEDED) ||
(errorData.status === HTTP_STATUS_CODE_FORBIDDEN &&
- errorData.code === 'access_denied_insufficient_permissions')
+ errorData.code === ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS)
) {
this.errorCallback(errorData);
return;
diff --git a/src/api/uploads/__tests__/MultiputUpload.test.js b/src/api/uploads/__tests__/MultiputUpload.test.js
index 91c05798d1..5ea3cb010e 100644
--- a/src/api/uploads/__tests__/MultiputUpload.test.js
+++ b/src/api/uploads/__tests__/MultiputUpload.test.js
@@ -9,7 +9,10 @@ import MultiputPart, {
PART_STATE_NOT_STARTED,
} from '../MultiputPart';
-import { ERROR_CODE_UPLOAD_STORAGE_LIMIT_EXCEEDED } from '../../../constants';
+import {
+ ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS,
+ ERROR_CODE_UPLOAD_STORAGE_LIMIT_EXCEEDED,
+} from '../../../constants';
const config = {
a: 1,
@@ -410,7 +413,7 @@ describe('api/uploads/MultiputUpload', () => {
test.each`
data
${{ code: ERROR_CODE_UPLOAD_STORAGE_LIMIT_EXCEEDED, status: 403 }}
- ${{ code: 'access_denied_insufficient_permissions', status: 403 }}
+ ${{ code: ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS, status: 403 }}
`('should invoke errorCallback but not sessionErrorHandler on expected failure', async ({ data }) => {
// Setup
const error = {
diff --git a/src/constants.js b/src/constants.js
index ba71f07d1d..9f2006780e 100644
--- a/src/constants.js
+++ b/src/constants.js
@@ -276,6 +276,7 @@ export const ERROR_CODE_ITEM_NAME_TOO_LONG = 'item_name_too_long';
export const ERROR_CODE_ITEM_NAME_IN_USE = 'item_name_in_use';
export const ERROR_CODE_UPLOAD_FILE_LIMIT = 'upload_file_limit';
export const ERROR_CODE_UPLOAD_CHILD_FOLDER_FAILED = 'child_folder_failed_upload';
+export const ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS = 'access_denied_insufficient_permissions';
export const ERROR_CODE_UPLOAD_STORAGE_LIMIT_EXCEEDED = 'storage_limit_exceeded';
export const ERROR_CODE_UPLOAD_FILE_SIZE_LIMIT_EXCEEDED = 'file_size_limit_exceeded';
export const ERROR_CODE_UPLOAD_PENDING_APP_FOLDER_SIZE_LIMIT = 'pending_app_folder_size_limit';
diff --git a/src/elements/common/messages.js b/src/elements/common/messages.js
index d9773595e3..40ba226022 100644
--- a/src/elements/common/messages.js
+++ b/src/elements/common/messages.js
@@ -747,6 +747,11 @@ const messages = defineMessages({
description: 'Error message shown when account storage limit has been reached',
defaultMessage: 'Account storage limit reached',
},
+ uploadsInsufficientPermissionsErrorMessage: {
+ id: 'be.uploadsInsufficientPermissionsErrorMessage',
+ description: 'Error message shown when the user lacks permission to upload to the destination folder',
+ defaultMessage: "You don't have permission to upload to this folder",
+ },
uploadsPendingFolderSizeLimitErrorMessage: {
id: 'be.uploadsPendingFolderSizeLimitErrorMessage',
description: 'Error message shown when pending app folder size exceeds the limit',
diff --git a/src/elements/content-uploader/__tests__/CellRenderer.test.tsx b/src/elements/content-uploader/__tests__/CellRenderer.test.tsx
index 735958f9d3..632a42cbd2 100644
--- a/src/elements/content-uploader/__tests__/CellRenderer.test.tsx
+++ b/src/elements/content-uploader/__tests__/CellRenderer.test.tsx
@@ -16,6 +16,7 @@ import {
ERROR_CODE_UPLOAD_CHILD_FOLDER_FAILED,
ERROR_CODE_UPLOAD_FAILED_PACKAGE,
ERROR_CODE_UPLOAD_FILE_SIZE_LIMIT_EXCEEDED,
+ ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS,
ERROR_CODE_UPLOAD_PENDING_APP_FOLDER_SIZE_LIMIT,
ERROR_CODE_UPLOAD_STORAGE_LIMIT_EXCEEDED,
} from '../../../constants';
@@ -99,6 +100,12 @@ describe('elements/content-uploader/CellRenderer', () => {
expect(screen.getByText('Account storage limit reached')).toBeInTheDocument();
});
+ test('renders distinct error message for insufficient permissions (403)', () => {
+ const rowData = { status: STATUS_ERROR, error: { code: ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS } };
+ renderComponent(rowData);
+ expect(screen.getByText("You don't have permission to upload to this folder")).toBeInTheDocument();
+ });
+
test('renders error message for pending app folder size limit', () => {
const rowData = { status: STATUS_ERROR, error: { code: ERROR_CODE_UPLOAD_PENDING_APP_FOLDER_SIZE_LIMIT } };
renderComponent(rowData);
diff --git a/src/elements/content-uploader/progressCellRenderer.tsx b/src/elements/content-uploader/progressCellRenderer.tsx
index 1bcef8c34d..810c2619fa 100644
--- a/src/elements/content-uploader/progressCellRenderer.tsx
+++ b/src/elements/content-uploader/progressCellRenderer.tsx
@@ -9,6 +9,7 @@ import {
ERROR_CODE_UPLOAD_FILE_SIZE_LIMIT_EXCEEDED,
ERROR_CODE_ITEM_NAME_IN_USE,
ERROR_CODE_ITEM_NAME_INVALID,
+ ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS,
ERROR_CODE_UPLOAD_PENDING_APP_FOLDER_SIZE_LIMIT,
ERROR_CODE_UPLOAD_STORAGE_LIMIT_EXCEEDED,
ERROR_CODE_UPLOAD_CHILD_FOLDER_FAILED,
@@ -48,6 +49,8 @@ const getErrorMessage = (
);
case ERROR_CODE_UPLOAD_STORAGE_LIMIT_EXCEEDED:
return ;
+ case ERROR_CODE_UPLOAD_INSUFFICIENT_PERMISSIONS:
+ return ;
case ERROR_CODE_UPLOAD_PENDING_APP_FOLDER_SIZE_LIMIT:
return ;
case ERROR_CODE_UPLOAD_FAILED_PACKAGE: