fix(clipboard): use privileged sc-clipboard protocol for image previews in dev mode#372
Merged
shobhit99 merged 1 commit intoMay 11, 2026
Conversation
…ws in dev mode In development the renderer is served on http://localhost, so raw file:// URLs for clipboard images are blocked by Electron's webSecurity. Register sc-clipboard:// as a privileged custom protocol that's handled by the main process via net.fetch(), and switch the ClipboardManager renderer to use it. - Register sc-clipboard in registerSchemesAsPrivileged with standard/secure/cors/bypassCSP/supportFetchAPI/stream flags - Add protocol handler in app.whenReady that decodes the path, normalises Windows drive letters, and serves via net.fetch() - Replace fileUrl() with clipboardImageUrl() in ClipboardManager.tsx to generate sc-clipboard:// URLs for image previews
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.
In development the renderer is served on http://localhost, so raw file:// URLs for clipboard images are blocked by Electron's webSecurity. This PR registers sc-clipboard:// as a privileged custom protocol, adds a main-process handler that serves files via net.fetch(), and switches the ClipboardManager renderer to use it.
Changes: