Preserve known top-level upgrade directories
This commit is contained in:
@@ -49,6 +49,11 @@ const COLD_ALLOWED_FILES = new Set([
|
||||
|
||||
const BLOCKED_TOP_LEVEL_NAMES = new Set(['.git', 'node_modules', '.next', 'dist', 'backups', 'local-storage', 'upgrade-state']);
|
||||
const BLOCKED_ANYWHERE_NAMES = new Set(['.git', 'node_modules', '.next']);
|
||||
const PAYLOAD_TOP_LEVEL_DIRECTORIES = new Set([
|
||||
...HOT_ALLOWED_PREFIXES.map(prefix => prefix.replace(/\/$/, '')),
|
||||
...COLD_ALLOWED_PREFIXES.map(prefix => prefix.replace(/\/$/, '')),
|
||||
...BLOCKED_TOP_LEVEL_NAMES,
|
||||
]);
|
||||
|
||||
let state = readState() || {
|
||||
id: jobId,
|
||||
@@ -382,7 +387,7 @@ function isAllowedArchive(file) {
|
||||
|
||||
function resolvePayloadRoot(root) {
|
||||
const entries = fs.readdirSync(root, { withFileTypes: true }).filter(entry => entry.name !== '__MACOSX');
|
||||
if (entries.length === 1 && entries[0].isDirectory()) {
|
||||
if (entries.length === 1 && entries[0].isDirectory() && !PAYLOAD_TOP_LEVEL_DIRECTORIES.has(entries[0].name)) {
|
||||
return path.join(root, entries[0].name);
|
||||
}
|
||||
return root;
|
||||
|
||||
Reference in New Issue
Block a user