From dc320eaa6cc099d49e71b21020c47035ff4c346e Mon Sep 17 00:00:00 2001 From: xream Date: Mon, 7 Oct 2024 17:26:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(file):=20=E6=96=B0=E5=A2=9E=E5=90=AF?= =?UTF-8?q?=E7=94=A8=E4=B8=8B=E8=BD=BD(=E6=96=87=E4=BB=B6=E5=90=8D?= =?UTF-8?q?=E4=B8=BA=E6=98=BE=E7=A4=BA=E5=90=8D=E7=A7=B0),=20=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=20>=202.14.264?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/restful/file.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/package.json b/backend/package.json index 790cfbc..f1587d3 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.385", + "version": "2.14.386", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/restful/file.js b/backend/src/restful/file.js index 13dd404..ff879f1 100644 --- a/backend/src/restful/file.js +++ b/backend/src/restful/file.js @@ -141,7 +141,14 @@ async function getFile(req, res) { )}`, ); } - + if (file.download) { + res.set( + 'Content-Disposition', + `attachment; filename*=UTF-8''${encodeURIComponent( + file.displayName || file.name, + )}`, + ); + } res.set('Content-Type', 'text/plain; charset=utf-8').send( output ?? '', );