Skip to content
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

Refresh error due to double encoding in verticalUrl #836

Merged
merged 3 commits into from
Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions layouts/html.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,11 @@
<script>
{{#babel}}
function iframeGetSearchParams() {
let params = new URLSearchParams(window.location.search);
let verticalUrl = window.location.pathname.substr(1)
if (verticalUrl) {
params.set('verticalUrl', verticalUrl);
}
return params.toString();
const params = window.location.search.substr(1);
const verticalUrl = window.location.pathname.substr(1);
return verticalUrl
? params + '&verticalUrl=' + verticalUrl
: params;
}
let iframeLoadedResolve;
window.iframeLoaded = new Promise(resolve => {
Expand Down
3 changes: 0 additions & 3 deletions static/js/iframe-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ export function generateIFrame(domain, queryParam, urlParam) {
var paramString = window.location.search;
paramString = paramString.substr(1, paramString.length);

// Decode ASCII forward slash to avod repeat encodings on page refreshes
paramString = paramString.replace("%2F", "/");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we able to get rid of this because window.location.search is already encoded?

Copy link
Contributor Author

@yen-tt yen-tt Jun 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it's already encoded pulling from browser. I believe this was added before to avoid the same double encoding problem with multilang when the verticalUrl is something like 'es/help_articles' but this change should fix this!


// Parse the params out of the URL
var params = paramString.split('&'),
verticalUrl;
Expand Down