Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/archiveDirectory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
// `tar` returns a `TypeError` if `allFiles` is empty. Let's check a feww things.
try {
fs.statSync(sourceDirectory);
} catch (err: any) {

Check warning on line 86 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
if (err.code === "ENOENT") {

Check warning on line 87 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .code on an `any` value
throw new FirebaseError(`Could not read directory "${sourceDirectory}"`);
}
throw err;
Expand All @@ -100,7 +100,7 @@
gzip: true,
file: tempFile.name,
cwd: sourceDirectory,
follow: true,
follow: false,
noDirRecurse: true,
portable: true,
},
Expand Down Expand Up @@ -135,13 +135,21 @@
let files: fsAsync.ReaddirRecursiveFile[];
try {
files = await fsAsync.readdirRecursive({ path: sourceDirectory, ignore: options.ignore });
} catch (err: any) {

Check warning on line 138 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
if (err.code === "ENOENT") {

Check warning on line 139 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .code on an `any` value
throw new FirebaseError(`Could not read directory "${sourceDirectory}"`, { original: err });

Check warning on line 140 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
}
throw err;
}
for (const file of files) {
// For security, filter out all symlinks. This code is a bit obtuse to preserve ordering.
const realFiles = (await Promise.all(

Check failure on line 145 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (22)

Insert `⏎····`

Check failure on line 145 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (20)

Insert `⏎····`

Check failure on line 145 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Insert `⏎····`

Check failure on line 145 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (20)

Insert `⏎····`
files.map(async (f) => {

Check failure on line 146 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (22)

Insert `··`

Check failure on line 146 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (20)

Insert `··`

Check failure on line 146 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Insert `··`

Check failure on line 146 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (20)

Insert `··`
const stats = await fs.promises.lstat(f.name);

Check failure on line 147 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (22)

Insert `··`

Check failure on line 147 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (20)

Insert `··`

Check failure on line 147 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Insert `··`

Check failure on line 147 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (20)

Insert `··`
return stats.isSymbolicLink() ? null : f;

Check failure on line 148 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (22)

Replace `······` with `········`

Check failure on line 148 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (20)

Replace `······` with `········`

Check failure on line 148 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Replace `······` with `········`

Check failure on line 148 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (20)

Replace `······` with `········`
}),

Check failure on line 149 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (22)

Insert `··`

Check failure on line 149 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (20)

Insert `··`

Check failure on line 149 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Insert `··`

Check failure on line 149 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (20)

Insert `··`
)).filter((fileOrNull): fileOrNull is typeof files[number] => fileOrNull !== null);

Check failure on line 150 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (22)

Replace `··)).filter((fileOrNull):·fileOrNull·is·typeof·files` with `····)⏎··).filter((fileOrNull):·fileOrNull·is·(typeof·files)`

Check failure on line 150 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (20)

Replace `··)).filter((fileOrNull):·fileOrNull·is·typeof·files` with `····)⏎··).filter((fileOrNull):·fileOrNull·is·(typeof·files)`

Check failure on line 150 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Replace `··)).filter((fileOrNull):·fileOrNull·is·typeof·files` with `····)⏎··).filter((fileOrNull):·fileOrNull·is·(typeof·files)`

Check failure on line 150 in src/archiveDirectory.ts

View workflow job for this annotation

GitHub Actions / unit (20)

Replace `··)).filter((fileOrNull):·fileOrNull·is·typeof·files` with `····)⏎··).filter((fileOrNull):·fileOrNull·is·(typeof·files)`

for (const file of realFiles) {
const name = path.relative(sourceDirectory, file.name);
allFiles.push(name);
archive.file(file.name, {
Expand Down
Loading