Skip to content

fix(clipboard): use privileged sc-clipboard protocol for image previews in dev mode#372

Merged
shobhit99 merged 1 commit into
SuperCmdLabs:mainfrom
monotykamary:fix-dev-clipboard-images
May 11, 2026
Merged

fix(clipboard): use privileged sc-clipboard protocol for image previews in dev mode#372
shobhit99 merged 1 commit into
SuperCmdLabs:mainfrom
monotykamary:fix-dev-clipboard-images

Conversation

@monotykamary
Copy link
Copy Markdown
Contributor

@monotykamary monotykamary commented May 8, 2026

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.

Before After
image image

Changes:

  • 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

…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
@shobhit99 shobhit99 merged commit ffb41b3 into SuperCmdLabs:main May 11, 2026
1 check failed
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.

2 participants