fix bug where paths can be undefined
This commit is contained in:
parent
2133727652
commit
feb20afa9e
|
@ -70,15 +70,18 @@ export async function getElectronFile(filePath: string): Promise<ElectronFile> {
|
|||
};
|
||||
}
|
||||
|
||||
export const getValidPaths = (paths: string[]) =>
|
||||
paths.filter(async (path) => {
|
||||
export const getValidPaths = (paths: string[]) => {
|
||||
if (!paths) {
|
||||
return [] as string[];
|
||||
}
|
||||
return paths.filter(async (path) => {
|
||||
try {
|
||||
await fs.stat(path).then((stat) => stat.isFile());
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
export const getZipFileStream = async (
|
||||
zip: StreamZip.StreamZipAsync,
|
||||
filePath: string
|
||||
|
|
Loading…
Reference in a new issue