-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(twitter-url): twitter vernacular url encode bug #194
base: master
Are you sure you want to change the base?
Conversation
@@ -33,7 +33,7 @@ class SocialShareBase extends React.Component { | |||
|
|||
return React.createElement(this.props.template, Object.assign({ | |||
fbUrl: `https://www.facebook.com/sharer.php?u=${encodeURIComponent(fullUrl)}`, | |||
twitterUrl: `https://twitter.com/intent/tweet?url=${encodeURIComponent(fullUrl)}&text=${encodeURIComponent(this.props.title)}&hashtags=${hashtags}`, | |||
twitterUrl: `https://twitter.com/intent/tweet?url=${encodeURI(fullUrl)}&text=${encodeURIComponent(this.props.title)}&hashtags=${hashtags}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can pass the encoded Url from the app level?
<SocialShare
template={ShareAllTemplate}
title={storyData.headline}
fullUrl={encodeURI(story.url)}
/>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it is easier to fix in the implementation level rather than modifying ever use case in the app level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, Prothomalo and Prabhatkbhar, They already passing it in encoded form. @sivteck
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome
Description
When there is vernacular text in the shared article url, twitter breaks the output from
encodeURIComponent
, see the linked issue for descriptionFixes https://github.com/quintype/madrid/issues/4105
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
The fix is to just use
encodeURI
function insteadDifferences between these functions are documented here,
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent#description
Checklist: