From 4add8a5a8a9f751da92f09cb30a883cf32edabb2 Mon Sep 17 00:00:00 2001 From: stringsplit <77242831+nbitzz@users.noreply.github.com> Date: Tue, 26 Mar 2024 16:48:28 -0700 Subject: [PATCH] Fix 500 error which should be 404 --- src/server/routes/api/v1/file/individual.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/server/routes/api/v1/file/individual.ts b/src/server/routes/api/v1/file/individual.ts index 7429974..3a00086 100644 --- a/src/server/routes/api/v1/file/individual.ts +++ b/src/server/routes/api/v1/file/individual.ts @@ -31,11 +31,12 @@ export default function(files: Files) { ctx.header("Accept-Ranges", "bytes") ctx.header("Access-Control-Allow-Origin", "*") ctx.header("Content-Security-Policy", "sandbox allow-scripts") - 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) { + 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.visibility == "private") { if (acc?.id != file.owner) { return ServeError(ctx, 403, "you do not own this file")