UNPKG

@aws-amplify/storage

Version:

Storage category of aws-amplify

1 lines 1.01 kB
{"version":3,"file":"validateRemovePath.mjs","sources":["../../../../../src/providers/s3/utils/validateRemovePath.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Validates that the path is safe for removal operations.\n * Prevents deletion of dangerous paths that could affect entire buckets.\n *\n * @param path - The path to validate\n * @throws Error if the path is considered dangerous\n */\nexport const validateRemovePath = (path) => {\n const DANGEROUS_PATHS = ['', '/', '*'];\n if (DANGEROUS_PATHS.includes(path.trim())) {\n throw new Error('Cannot delete root or bucket-wide paths');\n }\n};\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,kBAAkB,GAAG,CAAC,IAAI,KAAK;AAC5C,IAAI,MAAM,eAAe,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC;AAC1C,IAAI,IAAI,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE;AAC/C,QAAQ,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC;AAClE,IAAI;AACJ;;;;"}