@samitouri / QOSami-HFS / commits / 6b31ac44

fix: showing delete/rename commands on the parent folder even when they were limited to the children

Massimo Melina committed May 9, 2025 at 00:37 UTC 6b31ac448d3a1004ba65fcd4245fd4b668e2e280
1 file changed +2 -3
src/api.get_file_list.ts
+2 -3
@@ -47,9 +47,8 @@ export const get_file_list: ApiHandler = async ({ uri='/', offset, limit, c, onl
47 const walker = walkNode(node, { ctx: admin ? undefined : ctx, onlyFolders, onlyFiles, depth })
48 const onDirEntryHandlers = mapPlugins(plug => plug.onDirEntry)
49 const can_upload = admin || hasPermission(node, 'can_upload', ctx)
50 - const fakeChild = await applyParentToChild({ source: 'dummy-file', original: undefined }, node) // used to check permission; simple but can produce false results; 'original' to simulate a non-vfs node
51 - const can_delete = admin || hasPermission(fakeChild, 'can_delete', ctx)
52 - const can_archive = admin || hasPermission(fakeChild, 'can_archive', ctx)
50 + const can_delete = admin || hasPermission(node, 'can_delete', ctx)
51 + const can_archive = admin || hasPermission(node, 'can_archive', ctx)
52 const can_comment = can_upload && areCommentsEnabled()
53 const can_overwrite = can_upload && (can_delete || !dontOverwriteUploading.get())
54 const comment = node.comment ?? await getCommentFor(node.source)