mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: remove unused vars
This commit is contained in:
1 parent
d0471b0de8
commit
c80ce1ed79
2 files changed
+4
-4
No files matched your search
@@ -419,11 +419,11 @@ export class ProblemFileDownloadHandler extends ProblemDetailHandler {
|
|||||||
const file = await storage.getMeta(target);
|
const file = await storage.getMeta(target);
|
||||||
if (!file) throw new NotFoundError(filename);
|
if (!file) throw new NotFoundError(filename);
|
||||||
this.response.etag = file.etag;
|
this.response.etag = file.etag;
|
||||||
const type = lookup(filename).toString();
|
const fileType = lookup(filename).toString();
|
||||||
const shouldProxy = ['image', 'video', 'audio', 'pdf', 'vnd'].filter((i) => type.includes(i)).length;
|
const shouldProxy = ['image', 'video', 'audio', 'pdf', 'vnd'].filter((i) => fileType.includes(i)).length;
|
||||||
if (shouldProxy && file.size! < 32 * 1024 * 1024) {
|
if (shouldProxy && file.size! < 32 * 1024 * 1024) {
|
||||||
this.response.body = await storage.get(target);
|
this.response.body = await storage.get(target);
|
||||||
this.response.type = file['Content-Type'] || type;
|
this.response.type = file['Content-Type'] || fileType;
|
||||||
if (!noDisposition) this.response.addHeader('Content-Disposition', `attachment; filename=${filename}`);
|
if (!noDisposition) this.response.addHeader('Content-Disposition', `attachment; filename=${filename}`);
|
||||||
} else {
|
} else {
|
||||||
this.response.redirect = await storage.signDownloadLink(
|
this.response.redirect = await storage.signDownloadLink(
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import fs from 'fs-extra';
|
|||||||
import AdmZip from 'adm-zip';
|
import AdmZip from 'adm-zip';
|
||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import { Route, Handler } from 'hydrooj/src/service/server';
|
import { Route, Handler } from 'hydrooj/src/service/server';
|
||||||
import { BadRequestError, ValidationError } from 'hydrooj/src/error';
|
import { ValidationError } from 'hydrooj/src/error';
|
||||||
import { ProblemAdd } from 'hydrooj/src/lib/ui';
|
import { ProblemAdd } from 'hydrooj/src/lib/ui';
|
||||||
import problem from 'hydrooj/src/model/problem';
|
import problem from 'hydrooj/src/model/problem';
|
||||||
import { PERM } from 'hydrooj/src/model/builtin';
|
import { PERM } from 'hydrooj/src/model/builtin';
|
||||||
|
|||||||
Reference in new issue
Block a user