mirror of
https://github.com/versia-pub/server.git
synced 2026-01-26 04:06:01 +01:00
feat(api): ✨ Add real filename to proxy
This commit is contained in:
parent
7f4e39e08b
commit
908fdcaa79
|
|
@ -45,6 +45,11 @@ export default (app: Hono) =>
|
|||
},
|
||||
});
|
||||
|
||||
const realFilename =
|
||||
media.headers
|
||||
.get("Content-Disposition")
|
||||
?.match(/filename="(.+)"/)?.[1] || id.split("/").pop();
|
||||
|
||||
return response(media.body, media.status, {
|
||||
"Content-Type":
|
||||
media.headers.get("Content-Type") ||
|
||||
|
|
@ -52,6 +57,8 @@ export default (app: Hono) =>
|
|||
"Content-Length": media.headers.get("Content-Length") || "0",
|
||||
"Content-Security-Policy": "",
|
||||
"Content-Encoding": "",
|
||||
// Real filename
|
||||
"Content-Disposition": `inline; filename="${realFilename}"`,
|
||||
});
|
||||
},
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue