@aws-amplify/storage
Version:
Storage category of aws-amplify
19 lines (17 loc) • 633 B
JavaScript
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.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');
}
};
export { validateRemovePath };
//# sourceMappingURL=validateRemovePath.mjs.map