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")