fix(icon-generator): handle oversized URLs in onCopyShareUrl#451
Draft
spokodev wants to merge 1 commit into
Draft
fix(icon-generator): handle oversized URLs in onCopyShareUrl#451spokodev wants to merge 1 commit into
spokodev wants to merge 1 commit into
Conversation
Copying a share URL from the icon editor failed silently when a custom image was selected: the resulting URL embeds the image as base64 in search params, which blows past the shorten-url endpoint's ~2KB ceiling. The fetch threw, the loading toast stayed on screen, and the clipboard was never written. Skip the shorten step when the URL exceeds 2KB and copy the unshortened URL with a clarifying toast. Wrap the shorten request in try/catch so network or CORS failures fall through to the same unshortened-copy path instead of stalling. Closes raycast#444
Contributor
|
@spokodev is attempting to deploy a commit to the Raycast Team on Vercel. A member of the Team first needs to authorize it. |
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.
Closes #444.
When a user uploads a custom image into the icon editor and clicks "Copy URL", the loading toast appears and never resolves: the URL embeds the image as base64 in search params, the shorten-url endpoint rejects requests above ~2KB, the
fetch().then(res.json())chain throws on the network/CORS failure, and theclipboard.writeTextline is never reached.The fix in
app/(navigation)/icon/icon-generator.tsx:onCopyShareUrl:response.ok. Any network, CORS, or non-OK response falls through to copying the unshortened URL, so the clipboard is always written and the loading toast always resolves.The 2KB threshold matches the issue reporter's "Staying under 2,000 characters is safest for compatibility" note and is comfortably below the practical URL length ceiling on every major browser.
Manual verification