From 246549acdf5398c6ca1b784cdec3a31cd0be4628 Mon Sep 17 00:00:00 2001 From: E44 <129310925+programmer-44@users.noreply.github.com> Date: Wed, 14 Jan 2026 19:25:21 +0100 Subject: [PATCH] fix(control): folders could only be created in path '/' --- control/frontend/src/lib/ts/stores/files.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/control/frontend/src/lib/ts/stores/files.ts b/control/frontend/src/lib/ts/stores/files.ts index 3288b4e..2565cb6 100755 --- a/control/frontend/src/lib/ts/stores/files.ts +++ b/control/frontend/src/lib/ts/stores/files.ts @@ -125,19 +125,23 @@ export async function get_displays_where_path_exists( const path_without_last_part = path.slice(0, path.length - (last_path_part.length + 1)); const folders_of_current_path = await db.files - .where('[path+name+type]') - .equals([path_without_last_part, last_path_part, 'inode/directory']) + .where('name') + .equals(last_path_part) + .filter((inode) => inode.path === path_without_last_part && inode.type === 'inode/directory') .first(); if (!folders_of_current_path) return await db.displays.where('id').anyOf(selected_display_ids).toArray(); const folder_primary_key = get_file_primary_key(folders_of_current_path); - const display_ids = selected_display_ids.filter(async (display_id) => { - const folder_exists = await db.files_on_display.get([display_id, folder_primary_key]); + const display_ids_with_folder = ( + await db.files_on_display.where('file_primary_key').equals(folder_primary_key).toArray() + ).map((fod) => fod.display_id); + + const display_ids = selected_display_ids.filter((display_id) => { if (invert) { - return !folder_exists; + return !display_ids_with_folder.includes(display_id); } else { - return folder_exists; + return display_ids_with_folder.includes(display_id); } });