@aws-amplify/storage
Version:
Storage category of aws-amplify
22 lines (20 loc) • 764 B
JavaScript
;
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateRemovePath = void 0;
/**
* Validates that the path is safe for removal operations.
* Prevents deletion of dangerous paths that could affect entire buckets.
*
* @param path - The path to validate
* @throws Error if the path is considered dangerous
*/
const validateRemovePath = (path) => {
const DANGEROUS_PATHS = ['', '/', '*'];
if (DANGEROUS_PATHS.includes(path.trim())) {
throw new Error('Cannot delete root or bucket-wide paths');
}
};
exports.validateRemovePath = validateRemovePath;
//# sourceMappingURL=validateRemovePath.js.map