mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-24 14:46:27 -08:00
Fix 500 error which should be 404
This commit is contained in:
parent
0bf5f6f985
commit
4add8a5a8a
|
@ -31,11 +31,12 @@ export default function(files: Files) {
|
||||||
ctx.header("Accept-Ranges", "bytes")
|
ctx.header("Accept-Ranges", "bytes")
|
||||||
ctx.header("Access-Control-Allow-Origin", "*")
|
ctx.header("Access-Control-Allow-Origin", "*")
|
||||||
ctx.header("Content-Security-Policy", "sandbox allow-scripts")
|
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) {
|
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 (file.visibility == "private") {
|
||||||
if (acc?.id != file.owner) {
|
if (acc?.id != file.owner) {
|
||||||
return ServeError(ctx, 403, "you do not own this file")
|
return ServeError(ctx, 403, "you do not own this file")
|
||||||
|
|
Loading…
Reference in a new issue