diff --git a/src/services/fileService.ts b/src/services/fileService.ts index a519f807d..c78f2169c 100644 --- a/src/services/fileService.ts +++ b/src/services/fileService.ts @@ -18,6 +18,8 @@ import { SetFiles } from 'types/gallery'; import { MAX_TRASH_BATCH_SIZE } from 'constants/file'; import { BulkUpdateMagicMetadataRequest } from 'types/magicMetadata'; import { addLogLine } from 'utils/logging'; +import { isCollectionHidden } from 'utils/collection'; +import { CustomError } from 'utils/error'; const ENDPOINT = getEndpoint(); const FILES_TABLE = 'files'; @@ -63,6 +65,9 @@ export const syncFiles = async ( if (!getToken()) { continue; } + if (isCollectionHidden(collection)) { + throw CustomError.HIDDEN_COLLECTION_SYNC_FILE_ATTEMPTED; + } const lastSyncTime = await getCollectionLastSyncTime(collection); if (collection.updationTime === lastSyncTime) { continue; diff --git a/src/utils/error/index.ts b/src/utils/error/index.ts index 9d08e0ca7..6da8d1c9d 100644 --- a/src/utils/error/index.ts +++ b/src/utils/error/index.ts @@ -47,6 +47,7 @@ export enum CustomError { INCORRECT_PASSWORD = 'incorrect password', UPLOAD_CANCELLED = 'upload cancelled', REQUEST_TIMEOUT = 'request taking too long', + HIDDEN_COLLECTION_SYNC_FILE_ATTEMPTED = 'hidden collection sync file attempted', } function parseUploadErrorCodes(error) {