Fix Safari NotAllowedError when generating a public sharing link#3767
Draft
Fix Safari NotAllowedError when generating a public sharing link#3767
Conversation
There was a problem hiding this comment.
No application code in the PR — skipped Code Health checks.
See analysis details in CodeScene
Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
Copilot
AI
changed the title
[WIP] Fix clipboard error on Safari after link generation
Fix Safari NotAllowedError when generating a public sharing link
Mar 26, 2026
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.
Safari blocks
navigator.clipboard.writeText()withNotAllowedErrorwhen it is called after anawaitin an event handler, because the user-gesture context is lost across the async boundary. InShareRestrictionModal, the clipboard write happened afterawait createPermissions(...), so it always failed on the first click in Safari.Changes (
cozy-sharing—packages/cozy-sharing/src/components/ShareRestrictionModal/)ShareRestrictionModal.jsx— restructurehandleClickto build aPromise<Blob>for the URL without awaiting it first, then pass that promise directly tocopyToClipboard. The clipboard API call is now initiated synchronously within the click handler; only the content resolution is async.helpers.js— extendcopyToClipboardto acceptstring | Promise<Blob>. When aPromise<Blob>is received andClipboardItemis available, usenavigator.clipboard.write([new ClipboardItem({...})])instead ofwriteText. Safari supports this pattern: the permission check happens at call time (synchronous, within the gesture), the blob is consumed when the promise resolves.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
errors.cozycloud.ccpkg['devDependencies'] = dict(sorted(pkg['devDependencies'].items()))
with open('package. ake-drive/src/coadd ake-drive/src/co-f ake-drive/src/conode_modules/cozy-sharing ake-�� d.*copy ake-drive/src/components/FileHistory/HistoryModal.jsx` (dns block)
Original prompt
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.