Skip to content

feat: recursive subfolder filtering + gallery tree navigation#140

Open
ghosttigerllc-bit wants to merge 1 commit intoComfyAssets:mainfrom
ghosttigerllc-bit:feat/recursive-subfolder-gallery-tree
Open

feat: recursive subfolder filtering + gallery tree navigation#140
ghosttigerllc-bit wants to merge 1 commit intoComfyAssets:mainfrom
ghosttigerllc-bit:feat/recursive-subfolder-gallery-tree

Conversation

@ghosttigerllc-bit
Copy link
Copy Markdown

Summary

  • Recursive subfolder filtering: selecting an intermediate folder (e.g. 2025/08/) shows all images in child folders
  • Gallery page tree navigation panel with collapsible folder hierarchy, sticky positioning, and drag-to-resize
  • Thumbnail size controls (S/M/L buttons) for adjustable grid density
  • Fix path collision when multiple gallery roots share overlapping relative paths (P1 from feat: multi-directory gallery scan with folder filter (#126) #135 review)
  • Fix auto-detect mode collapsing nested folders to ambiguous basenames (P2 from feat: multi-directory gallery scan with folder filter (#126) #135 review)
  • Security test suite for path traversal edge cases (symlink escape, null bytes, traversal sequences)

Changes

Backend

  • database/operations.py: Added include_ancestors parameter to get_prompt_subfolders() — generates all intermediate path segments for tree rendering
  • py/api/prompts.py: /subfolders endpoint accepts ?include_ancestors=true
  • py/api/images.py: /gallery/subfolders endpoint also accepts ?include_ancestors=true; serve_output_image accepts optional ?root=N for future multi-root disambiguation; auto-detect mode preserves full folder paths instead of collapsing to basenames

Frontend

  • web/js/admin.js: Subfolder dropdown requests hierarchical data and renders with indentation
  • web/js/gallery.js: Folder tree panel (collapsible, sticky, resizable), subfolder filtering on image grid, S/M/L thumbnail size buttons using inline grid-template-columns
  • web/gallery.html: Split-pane layout with independently-scrolling folder tree and image grid

Tests

  • tests/test_lora_database.py: 3 new tests for include_ancestors behavior
  • tests/test_path_security.py: 12 new tests covering symlink escape, path traversal, null bytes, and root index validation

Test plan

  • All 22 existing subfolder/database tests pass
  • 3 new ancestor hierarchy tests pass
  • 12 new path security tests pass
  • Manual testing with deeply nested date-based folder structure (20,618 images)
  • Manual testing of tree navigation, folder filtering, and thumbnail sizing
  • Verified sticky sidebar scrolls independently from gallery grid

Addresses feedback from #126 (subfolder filtering + gallery navigation).
Fixes code review items P1 and P2 from #135.

🤖 Generated with Claude Code

…nail sizing

- Recursive subfolder filtering: selecting an intermediate folder shows all child images
- Gallery tree navigation panel with collapsible folder hierarchy (sticky, resizable)
- Thumbnail size controls (S/M/L) for adjustable grid density
- Fix path collision when multiple gallery roots share overlapping relative paths
- Fix auto-detect mode collapsing nested folders to ambiguous basenames
- Security test suite for path traversal edge cases

Addresses feedback from ComfyAssets#126. Fixes code review items P1/P2 from ComfyAssets#135.

Co-Authored-By: Kai Bowie <kaigtb@proton.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant