mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: use encoded disposition
This commit is contained in:
1 parent
d462a36b73
commit
bf2179d56c
5 files changed
+5
-5
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.32.24",
|
"version": "2.32.25",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ export class ContestProblemFileDownloadHandler extends ContestProblemHandler {
|
|||||||
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'] || type;
|
||||||
if (!noDisposition) this.response.addHeader('Content-Disposition', `attachment; filename=${filename}`);
|
this.response.disposition = `attachment; filename=${encodeURIComponent(filename)}`;
|
||||||
} else {
|
} else {
|
||||||
this.response.redirect = await storage.signDownloadLink(
|
this.response.redirect = await storage.signDownloadLink(
|
||||||
target, noDisposition ? undefined : filename, false, 'user',
|
target, noDisposition ? undefined : filename, false, 'user',
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ export class HomeworkProblemFileDownloadHandler extends HomeworkDetailProblemHan
|
|||||||
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'] || type;
|
||||||
if (!noDisposition) this.response.addHeader('Content-Disposition', `attachment; filename=${filename}`);
|
this.response.disposition = `attachment; filename=${encodeURIComponent(filename)}`;
|
||||||
} else {
|
} else {
|
||||||
this.response.redirect = await storage.signDownloadLink(
|
this.response.redirect = await storage.signDownloadLink(
|
||||||
target, noDisposition ? undefined : filename, false, 'user',
|
target, noDisposition ? undefined : filename, false, 'user',
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ export class FSDownloadHandler extends Handler {
|
|||||||
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'] || type;
|
||||||
if (!noDisposition) this.response.addHeader('Content-Disposition', `attachment; filename=${filename}`);
|
this.response.disposition = `attachment; filename=${encodeURIComponent(filename)}`;
|
||||||
} else {
|
} else {
|
||||||
this.response.redirect = await storage.signDownloadLink(
|
this.response.redirect = await storage.signDownloadLink(
|
||||||
target, noDisposition ? undefined : filename, false, 'user',
|
target, noDisposition ? undefined : filename, false, 'user',
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ export class ProblemFileDownloadHandler extends ProblemDetailHandler {
|
|||||||
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'] || fileType;
|
this.response.type = file['Content-Type'] || fileType;
|
||||||
if (!noDisposition) this.response.addHeader('Content-Disposition', `attachment; filename=${filename}`);
|
this.response.disposition = `attachment; filename=${encodeURIComponent(filename)}`;
|
||||||
} else {
|
} else {
|
||||||
this.response.redirect = await storage.signDownloadLink(
|
this.response.redirect = await storage.signDownloadLink(
|
||||||
target, noDisposition ? undefined : filename, false, 'user',
|
target, noDisposition ? undefined : filename, false, 'user',
|
||||||
|
|||||||
Reference in new issue
Block a user