fix: wrong http status on for not-found

Massimo Melina committed Mar 29, 2022 at 23:55 UTC 1228e1108ce48501d2e944111495ac7d4f282758
1 file changed +1 -2
server/src/middlewares.ts
+1 -2
@@ -17,7 +17,6 @@ import { getAccount, getCurrentUsername } from './perm'
17 import { getConfig, subscribeConfig } from './config'
18 import { getConnections, socket2connection, updateConnection } from './connections'
19 import { Socket } from 'net'
20 -import { isMatch } from 'micromatch'
20
21 export const gzipper = compress({
22 threshold: 2048,
@@ -67,7 +66,7 @@ export const serveGuiAndSharedFiles: Koa.Middleware = async (ctx, next) => {
66 const node = await urlToNode(path, ctx)
67 if (!node) {
68 ctx.body = "Not found. Sometimes you need to login first."
70 - return next()
69 + return ctx.status = 404
70 }
71 if (!hasPermission(node, 'can_read', ctx))
72 return ctx.status = cantReadStatusCode(node)