mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
codeql: remove some useless check
This commit is contained in:
1 parent
8c6f9a3b71
commit
07d7a38a1b
7 files changed
+18
-23
No files matched your search
@@ -62,20 +62,18 @@ class FpsProblemImportHandler extends Handler {
|
||||
async post({ domainId }) {
|
||||
if (!this.request.files.file) throw new ValidationError('file');
|
||||
const tasks = [];
|
||||
if (this.request.files.file) {
|
||||
try {
|
||||
const content = fs.readFile(this.request.files.file.path).toString();
|
||||
const result = await xml2js.parseStringPromise(content);
|
||||
tasks.push(result);
|
||||
} catch (e) {
|
||||
const zip = new AdmZip(this.request.files.file.path);
|
||||
for (const entry of zip.getEntries()) {
|
||||
try {
|
||||
const content = entry.getData().toString();
|
||||
const result = await xml2js.parseStringPromise(content);
|
||||
tasks.push(result);
|
||||
} catch { } // eslint-disable-line no-empty
|
||||
}
|
||||
try {
|
||||
const content = fs.readFile(this.request.files.file.path).toString();
|
||||
const result = await xml2js.parseStringPromise(content);
|
||||
tasks.push(result);
|
||||
} catch (e) {
|
||||
const zip = new AdmZip(this.request.files.file.path);
|
||||
for (const entry of zip.getEntries()) {
|
||||
try {
|
||||
const content = entry.getData().toString();
|
||||
const result = await xml2js.parseStringPromise(content);
|
||||
tasks.push(result);
|
||||
} catch { } // eslint-disable-line no-empty
|
||||
}
|
||||
}
|
||||
if (!tasks.length) throw new ValidationError('file');
|
||||
|
||||
Reference in new issue
Block a user