From d63be65ad180d7fdc18be8748b846ef2d4330e00 Mon Sep 17 00:00:00 2001 From: xEsiah Date: Mon, 19 Oct 2026 14:47:56 +0200 Subject: [PATCH 1/2] fix(trash): delete on-disk thumbnails when purging files --- backend/src/routes/trash.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/backend/src/routes/trash.ts b/backend/src/routes/trash.ts index 08ca04b..adfb4eb 100644 --- a/backend/src/routes/trash.ts +++ b/backend/src/routes/trash.ts @@ -70,10 +70,18 @@ const purgeFiles = async (db: Db, config: Config, fileIds: string[]): Promise discard(absolutePath(config.MEDIA_DIR, row.relative_path))), + // Les vignettes vivent dans VARIANT_DIR : sans cette etape, chaque purge + // laisse un .webp orphelin sur le disque (les lignes partent en cascade). + const variants = await db.query<{ path: string }>( + `SELECT path FROM file_variants WHERE file_id IN (${placeholders})`, + fileIds, ); + await Promise.all([ + ...rows.map((row) => discard(absolutePath(config.MEDIA_DIR, row.relative_path))), + ...variants.map((variant) => discard(absolutePath(config.VARIANT_DIR, variant.path))), + ]); + await db.transaction(async (connection) => { for (const row of rows) { if (row.owner_id) { -- 2.54.0 From a97a3fcf5d11336cb1edfe927c5a4f58fe5e4511 Mon Sep 17 00:00:00 2001 From: xEsiah Date: Mon, 19 Oct 2026 15:44:54 +0200 Subject: [PATCH 2/2] fix(folders): stop exposing every root folder to admins The listing applied an admin bypass that showed all private root folders of other accounts, contradicting access.ts policy (admin role grants no folder-level rights). Remove it: visibility is now owner, public, or traversable share only. --- backend/src/routes/folders.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/backend/src/routes/folders.ts b/backend/src/routes/folders.ts index ff6e46f..24165fe 100644 --- a/backend/src/routes/folders.ts +++ b/backend/src/routes/folders.ts @@ -129,14 +129,11 @@ export const registerFolderRoutes = (app: App, db: Db, config: Config): void => [parentId], ); - // Un enfant est visible s'il est lisible directement ou s'il mene a un partage. + // Un enfant est visible s'il est lisible directement ou s'il mene a un + // partage. Le role admin ne donne aucun droit special ici (voir access.ts). const visible: FolderRow[] = []; for (const row of rows) { - if ( - user.role_slug === "admin" || - row.owner_id === user.id || - (await canTraverse(db, user, row.id)) - ) { + if (row.owner_id === user.id || (await canTraverse(db, user, row.id))) { visible.push(row); } } -- 2.54.0