From 3377f2fdbc1a7c8a7f7d4cf651a02f13dd4e0fbf Mon Sep 17 00:00:00 2001 From: xream Date: Thu, 15 Jan 2026 05:36:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E5=88=A0=E9=99=A4=E5=93=8D=E5=BA=94=E5=A4=B4?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/restful/download.js | 12 ++++++++++-- backend/src/restful/file.js | 6 +++++- backend/src/vendor/express.js | 5 +++++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/backend/package.json b/backend/package.json index e760e34e..65bf2bf1 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.21.2", + "version": "2.21.3", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/restful/download.js b/backend/src/restful/download.js index 6c8afd70..caec4008 100644 --- a/backend/src/restful/download.js +++ b/backend/src/restful/download.js @@ -364,7 +364,11 @@ async function downloadSubscription(req, res) { if ($options?._res?.headers) { Object.entries($options._res.headers).forEach( ([key, value]) => { - res.set(key, value); + if (value == null) { + res.removeHeader(key); + } else { + res.set(key, value); + } }, ); } @@ -650,7 +654,11 @@ async function downloadCollection(req, res) { if ($options?._res?.headers) { Object.entries($options._res.headers).forEach( ([key, value]) => { - res.set(key, value); + if (value == null) { + res.removeHeader(key); + } else { + res.set(key, value); + } }, ); } diff --git a/backend/src/restful/file.js b/backend/src/restful/file.js index 5a9c988d..8a0714e9 100644 --- a/backend/src/restful/file.js +++ b/backend/src/restful/file.js @@ -193,7 +193,11 @@ async function getFile(req, res, next) { if (output?.$options?._res?.headers) { Object.entries(output.$options._res.headers).forEach( ([key, value]) => { - res.set(key, value); + if (value == null) { + res.removeHeader(key); + } else { + res.set(key, value); + } }, ); } diff --git a/backend/src/vendor/express.js b/backend/src/vendor/express.js index 98326419..a6ec8b68 100644 --- a/backend/src/vendor/express.js +++ b/backend/src/vendor/express.js @@ -224,6 +224,11 @@ export default function express({ substore: $, port, host }) { headers[key] = val; return this; } + + removeHeader(key) { + delete headers[key]; + return this; + } })(); } }