feat(share): Enhance URL sharing to robustly handle extra URL parameters - #636
Open
TKanX wants to merge 4 commits into
Open
feat(share): Enhance URL sharing to robustly handle extra URL parameters#636TKanX wants to merge 4 commits into
TKanX wants to merge 4 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Summary:
Enhances the URL sharing functionality to be more robust in handling URLs that contain extra query parameters beyond the intended shared data. Previously, the URL parsing was sensitive to additional parameters, leading to errors when URLs were augmented by external services (like ChatGPT) with tracking flags or other parameters. This enhancement introduces a more resilient URL parsing mechanism that specifically extracts the shared data parameter while gracefully ignoring any extraneous parameters.
Related Issues:
Changes:
getUrlDatafunction:getUrlDatafunction to utilizeurl.searchParams.get('data')instead ofurl.search.slice(1)for retrieving compressed data from the URL.dataparameter, effectively disregarding any other parameters that might be present in the URL's query string.onShareButtonClickedfunction:onShareButtonClickedfunction remains updated to construct share URLs with a dedicateddataparameter using template literals:${location.origin}?data=${compressed}.dataparameter.