From dbe305953e00b41541ac770b66e1f6756da7019b Mon Sep 17 00:00:00 2001 From: stringsplit <77242831+nbitzz@users.noreply.github.com> Date: Tue, 26 Mar 2024 23:59:46 -0700 Subject: [PATCH] terrifying --- src/server/routes/api/v1/file/individual.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/server/routes/api/v1/file/individual.ts b/src/server/routes/api/v1/file/individual.ts index 68c7a31..cbdd677 100644 --- a/src/server/routes/api/v1/file/individual.ts +++ b/src/server/routes/api/v1/file/individual.ts @@ -35,7 +35,16 @@ export default function(files: Files, apiRoot: Hono) { if (file) { ctx.header("Content-Disposition", `${ctx.req.query("attachment") == "1" ? "attachment" : "inline"}; filename="${encodeURI(file.filename.replaceAll("\n","\\n"))}"`) ctx.header("ETag", file.md5) - //if (file.lastModified) ctx.header("Last-Modified", new Date(file.lastModified).toTimeString()) + if (file.lastModified) { + let lm = new Date(file.lastModified) + // TERRIFYING + ctx.header("Last-Modified", + `${['Sun','Mon','Tue','Wed','Thu','Fri','Sat'][lm.getUTCDay()]}, ${lm.getUTCDay()} ` + + `${['Jan','Feb','Mar','Apr','May','Jun',"Jul",'Aug','Sep','Oct','Nov','Dec'][lm.getUTCMonth()]}` + + ` ${lm.getUTCFullYear()} ${lm.getUTCHours().toString().padStart(2,"0")}` + + `:${lm.getUTCMinutes().toString().padStart(2,"0")}:${lm.getUTCSeconds().toString().padStart(2,"0")} GMT` + ) + } if (file.visibility == "private") { if (acc?.id != file.owner) {