fix: admin/accounts: a "redirect" with a folder that has a missing source, was causing a login-screen
Massimo Melina committed
Nov 15, 2024 at 00:24 UTC
a216b00efed3ba65300949bb09f1abe1cb653483
1 file changed
+1
-1
src/api.get_file_list.ts
+1
-1
@@ -29,7 +29,7 @@ export const get_file_list: ApiHandler = async ({ uri='/', offset, limit, search
29
return fail(HTTP_FOOL)
30
if (await hasDefaultFile(node, ctx) || !await nodeIsDirectory(node)) // in case of files without permission, we are provided with the frontend, and the location is the file itself
31
// so, we first check if you have a permission problem, to tell frontend to show login, otherwise we fall back to method_not_allowed, as it's proper for files.
32
- return fail(statusCodeForMissingPerm(node, 'can_read', ctx) ? undefined : HTTP_METHOD_NOT_ALLOWED)
32
+ return fail(!admin && statusCodeForMissingPerm(node, 'can_read', ctx) ? undefined : HTTP_METHOD_NOT_ALLOWED)
33
if (!admin && statusCodeForMissingPerm(node, 'can_list', ctx))
34
return fail()
35
offset = Number(offset)