mirror of
https://github.com/versia-pub/server.git
synced 2026-01-26 12:16: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, {
|
return response(media.body, media.status, {
|
||||||
"Content-Type":
|
"Content-Type":
|
||||||
media.headers.get("Content-Type") ||
|
media.headers.get("Content-Type") ||
|
||||||
|
|
@ -52,6 +57,8 @@ export default (app: Hono) =>
|
||||||
"Content-Length": media.headers.get("Content-Length") || "0",
|
"Content-Length": media.headers.get("Content-Length") || "0",
|
||||||
"Content-Security-Policy": "",
|
"Content-Security-Policy": "",
|
||||||
"Content-Encoding": "",
|
"Content-Encoding": "",
|
||||||
|
// Real filename
|
||||||
|
"Content-Disposition": `inline; filename="${realFilename}"`,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue