Repository navigation
feat(apps): Show in Finder for app results made on this computer - #2050
PabloWiedemann wants to merge 16 commits into
Conversation
An app result made on a local ComfyUI is already saved in the Apps build's output folder, but the page only had the image, so the preview could not reveal it. The page now sends the ComfyUI output reference (filename and subfolder, type output) as comfyFile. Desktop never takes a path from the page: it joins the reference to the Apps build's output folder, resolves links, checks the file is inside that folder and inside the same allowed output roots Assets uses, and checks its size matches the bytes the page shows. Only then does the item get savedOn computer and its folder. Show in folder for that item reveals the checked path from main and is not relayed to the page. The <outputDir>/apps check for the page's own show-in-folder call is unchanged.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
…o reference A result made on This computer before the page sent ComfyUI file references (or on a page that does not tag them) reached the preview with no folder, so it had no Show in Finder. When an item is marked savedOn computer and has no folder, or its reference does not resolve, Desktop now looks in the Apps build's output folder for a file with exactly the same bytes (same size first, then a byte compare, at most 5000 entries and 4 levels deep, no followed links). A match must still be inside that folder and inside the allowed output roots, and it is revealed through the same checked path.
…a' into claude/app-local-show-in-finder-1c9e83
… bytes Each preview item without a usable reference used to scan the whole Apps output folder on its own. One locator per preview now scans once, indexes files by size, and tries the reference before the bytes.
A slow byte lookup for an older preview could finish after a newer one and replace it, so only the newest preview for a window is shown now. The byte lookup scans the apps/ subfolder before the rest of the output folder, so a large shared folder does not use up the scan limit first. A failed reveal is caught, and test links are removed even when a test fails.
The byte lookup now scans the whole apps/ subtree in its own pass before the output root, so a root with thousands of files cannot use up the scan limit before an app's subfolder is reached. A linked apps/ folder is skipped, like every other link in the scan.
There was a problem hiding this comment.
🔍 Cursor Review — Consolidated panel
Triggered by @PabloWiedemann.
Found 10 finding(s).
| Severity | Count |
|---|---|
| 🟠 High | 2 |
| 🟡 Medium | 5 |
| 🟢 Low | 3 |
Panel: 8/8 reviewers contributed findings.
| const shown = items.map(({ comfyFile, folder, ...item }, i): AppOutputItem => { | ||
| const file = files[i] | ||
| if (file) return { ...item, savedOn: 'computer', folder: path.dirname(file) } | ||
| return folder && !comfyFile ? { ...item, folder } : item |
There was a problem hiding this comment.
🟢 Low — When an item has both folder and comfyFile and the lookup returns null, the page-supplied folder is dropped entirely (folder && !comfyFile). Since the renderer gates both the "Saved in" line and the Show-in-folder button on folder, a file that genuinely is on disk loses all location affordances whenever it was renamed, resized, or missed by the byte scan. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max edge-case).
- A file named by the page's reference must now have exactly the same bytes, not only the same size. - Files are checked against the allowed folders before they are read, opened without following links or blocking, and read only up to the expected size. - At most four same-size files are compared per output. - A lookup stops when a newer preview starts, the page navigates or closes, and the backdrop is not captured from a closed page. - apps/ and the rest of the output folder each get their own scan limit. - The scan includes files of any type, such as AAC audio.
|
Review comments handled in b9ca95f. Fixed
Already fixed
Not changed
|
…l-show-in-finder-1c9e83 # Conflicts: # src/main/apps/appsView.ts # src/main/apps/outputs.ts
…l-show-in-finder-1c9e83
…l-show-in-finder-1c9e83
…l-show-in-finder-1c9e83
|
Review comments handled in b9ca95f. Fixed
Already fixed
Not changed
|
The panel could send Show in folder for a preview that main had already replaced with newer outputs, and main resolved the index against the new files. Each preview now carries its turn, the panel sends it back with every action, and main drops an action whose turn is not the one it last showed. The page still gets only the action and the index.
|
Review follow-up. Branch: merged #2045 (3629faa). One conflict in Fixed (threads resolved)
Not changed (threads left open for the reviewer)
|
TL;DR: When an app result was made on This computer (the Apps build), the output preview now shows Show in Finder, and it reveals the real file in the Apps build's output folder.
Why: the app page keeps each result as a Blob and never gets a file path, so the preview had nothing to reveal. ComfyUI already saved the file; the page only knows its ComfyUI
filenameandsubfolder, and older results know nothing.Can affect: the app output preview for This computer results, and Show in folder from it. Main process only. Cloud results, and results the page saved itself to
<outputDir>/apps, do not change. The<outputDir>/appscheck on the page's owncomfy-apps:show-in-foldercall is unchanged.Stack (merge in order): … → #2045 → this PR
Pairs with: Comfy-Org/comfy-website#384, commits
da1e92adband0908a25b7onvinh/apps-preview(not pushed yet). Without them the page sends nothing new and nothing changes.Changes
outputs.ts): asavedOn: 'computer'item may carrycomfyFile: { filename, subfolder, type }. Onlytype: 'output'is kept. A filename with a separator,./.., or hidden characters, and a subfolder that is absolute or has..or empty parts, are dropped.outputLocatorinoutputFolders.ts):apps/first, then the rest of the folder, at most 5000 entries and 4 levels, no links followed. Same size first, then a byte compare.allowedPath).appsView.ts,resolveOutputFiles): a found file gives the itemsavedOn: 'computer'and its folder. A page-sent folder is never shown for an item with a reference. Show in folder reveals the checked path from main (checked again on click) and is not relayed to the page. Only the newest preview for a window is shown, so a slow lookup cannot replace a newer preview.Review
apps/, a linkedapps/folder being read, an unhandled reveal error, and test links left behind on failure. No critical findings.Testing
pnpm run typecheck,pnpm run lint,pnpm run format:check: pass.vitest run: 345 files, 7971 pass, 12 skipped. New tests:apps/folder,.., and cloud or Desktop-managed builds.pnpm run devon macOS with the comfy-website dev server:ComfyUI-Apps/output/apps/remove-background/cutout_00001_.png. A reference to a missing file and one with../both showed no button.apps/-first scan order (no unit test for these).