Fix file picker extension filtering
This commit is contained in:
@@ -15,12 +15,10 @@ export async function addFiles(state, cfg, files, elements) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
addFileWithDedup(state, await listZipFiles(file, cfg.allowedExt));
|
||||
const zipTree = await listZipFiles(file, cfg.allowedExt);
|
||||
if (zipTree) addFileWithDedup(state, zipTree);
|
||||
} catch (error) {
|
||||
addFileWithDedup(state, {
|
||||
id: crypto.randomUUID(), kind: 'zip', name: file.name, path: file.name,
|
||||
file, children: [], expanded: true, error: 'Не удалось раскрыть ZIP',
|
||||
});
|
||||
continue;
|
||||
}
|
||||
}
|
||||
render(state, elements);
|
||||
|
||||
@@ -41,12 +41,12 @@ export function onFolderChange(state, cfg, elements) {
|
||||
if (lowerPath.endsWith('.zip')) {
|
||||
try {
|
||||
const zip = await listZipFiles(file, cfg.allowedExt);
|
||||
rebaseTree(zip, rootName);
|
||||
addToFolder(zip);
|
||||
if (zip) {
|
||||
rebaseTree(zip, rootName);
|
||||
addToFolder(zip);
|
||||
}
|
||||
} catch (error) {
|
||||
addToFolder({ id: crypto.randomUUID(), kind: 'zip', name: parts.at(-1),
|
||||
path: relativePath, file, children: [], expanded: true,
|
||||
error: 'Не удалось раскрыть ZIP' });
|
||||
continue;
|
||||
}
|
||||
} else if (cfg.allowedExt.some((extension) => lowerPath.endsWith(extension))) {
|
||||
addToFolder({ id: crypto.randomUUID(), kind: 'file', name: parts.at(-1),
|
||||
|
||||
Reference in New Issue
Block a user