Repository navigation
feat: add local image insertion with file picker and hardened safety checks - #291
Merged
Merged
Conversation
… hardened safety checks - Add local image insertion support with file picker and toolbar button - Harden image copy with COPYFILE_EXCL flag to prevent overwrites - Add deconfliction loop limit (1000 iterations) to prevent hangs - Force image re-render on filePath change for correct URL resolution - Extract toolbar button into reusable RichMarkdownToolbarButton component - Use setHeading (not toggleHeading) for idempotent slash commands - Add path utilities (dirname, joinPath) with comprehensive tests - Add image utility functions for safe copy destination handling
9 tasks done
enrick-dev
pushed a commit
to enrick-dev/orca
that referenced
this pull request
Oct 15, 2026
… hardened safety checks (stablyai#291) - Add local image insertion support with file picker and toolbar button - Harden image copy with COPYFILE_EXCL flag to prevent overwrites - Add deconfliction loop limit (1000 iterations) to prevent hangs - Force image re-render on filePath change for correct URL resolution - Extract toolbar button into reusable RichMarkdownToolbarButton component - Use setHeading (not toggleHeading) for idempotent slash commands - Add path utilities (dirname, joinPath) with comprehensive tests - Add image utility functions for safe copy destination handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Users cannot easily insert images from their local computer into markdown notes. Previously, the image insertion feature relied on
window.prompt()which is unreliable in Electron, and required users to provide image URLs instead of selecting from the filesystem.Additionally, image handling lacked safety guards: there was no protection against silent file overwrites, no limit on filename deconfliction attempts, and relative image paths in the rich editor weren't resolved consistently with preview mode.
Solution
dialog.showOpenDialog) to let users select image files from their computerCOPYFILE_EXCLflag to prevent silent overwritessrctofile://URLs using the same resolver as preview mode, and re-renders whenfilePathchangesToolbarButtoninto reusableRichMarkdownToolbarButtonwith tooltip supportsetHeading(nottoggleHeading) for idempotent/h1,/h2,/h3behaviordirnameandjoinPathhelpers with comprehensive tests for cross-platform path handlingChanges
pickImageandcopyFileIPC handlers with safety checkseditorRef, added image toolbar buttondirnamefor Windows drive rootsTesting
/imageslash command