better error message trying to upload
Massimo Melina committed
Apr 25, 2024 at 12:46 UTC
d6d249e195c2e324ed01fb42c6950b81bc1056df
1 file changed
+3
-1
src/vfs.ts
+3
-1
@@ -191,8 +191,10 @@ export function hasPermission(node: VfsNode, perm: keyof VfsPerms, ctx: Koa.Cont
191
192
export function statusCodeForMissingPerm(node: VfsNode, perm: keyof VfsPerms, ctx: Koa.Context, assign=true) {
193
const ret = getCode()
194
- if (ret && assign)
194
+ if (ret && assign) {
195
ctx.status = ret
196
+ ctx.body = ret === HTTP_UNAUTHORIZED ? "Unauthorized" : "Forbidden"
197
+ }
198
return ret
199
200
function getCode() {