Skip to content
This repository was archived by the owner on Nov 13, 2024. It is now read-only.

Commit d5dca59

Browse files
authored
Feat: download as application/octet-stream
1 parent 4a597b5 commit d5dca59

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/routers/http_router.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ router.get("/download/:key/:fileName", async (ctx) => {
4040
const fileAbsPath = fileManager.toAbsolutePath(fileRelativePath);
4141
const fileDir = path.dirname(fileAbsPath);
4242
const fileName = path.basename(fileAbsPath);
43+
ctx.set("Content-Type","application/octet-stream");
44+
ctx.set("Content-Disposition","attachment");
4345
await send(ctx, fileName, { root: fileDir + "/" });
4446
} catch (error) {
4547
ctx.body = $t("http_router.downloadErr", { error: error.message });

0 commit comments

Comments
 (0)