core: import: handle error message for invalid zip

This commit is contained in:
undefined committed 2022-09-27 02:43:19 +08:00
1 parent cb424c9cac
commit 895d50530a
4 files changed
+24 -4

No files matched your search

+6 -1
View File
@@ -111,7 +111,12 @@ class FpsProblemImportHandler extends Handler {
} catch (e) {
if (e instanceof FileTooLargeError) throw e;
console.log(e);
const zip = new AdmZip(this.request.files.file.filepath);
let zip: AdmZip;
try {
zip = new AdmZip(this.request.files.file.filepath);
} catch (e) {
throw new ValidationError('zip', null, e.message);
}
for (const entry of zip.getEntries()) {
try {
const buf = entry.getData();