forked from mirror/MCSM-Daemon
Feat: download as application/octet-stream
This commit is contained in:
parent
4a597b59f2
commit
d5dca59253
@ -40,6 +40,8 @@ router.get("/download/:key/:fileName", async (ctx) => {
|
||||
const fileAbsPath = fileManager.toAbsolutePath(fileRelativePath);
|
||||
const fileDir = path.dirname(fileAbsPath);
|
||||
const fileName = path.basename(fileAbsPath);
|
||||
ctx.set("Content-Type","application/octet-stream");
|
||||
ctx.set("Content-Disposition","attachment");
|
||||
await send(ctx, fileName, { root: fileDir + "/" });
|
||||
} catch (error) {
|
||||
ctx.body = $t("http_router.downloadErr", { error: error.message });
|
||||
|
Loading…
Reference in New Issue
Block a user