Skip to content

Commit

Permalink
Merge pull request #9450 from Expensify/john-hash-url-internal
Browse files Browse the repository at this point in the history
Do not append & to internal Expenisfy URLs that have a # symbol.
  • Loading branch information
aldo-expensify authored Jun 20, 2022
2 parents 67a022a + a0cf4b2 commit 3546820
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libs/actions/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ function openOldDotLink(url) {
}

function buildOldDotURL({shortLivedAuthToken}) {
return `${CONFIG.EXPENSIFY.EXPENSIFY_URL}${url}${url.indexOf('?') === -1 ? '?' : '&'}authToken=${shortLivedAuthToken}&email=${encodeURIComponent(currentUserEmail)}`;
const hasHashParams = url.indexOf('#') !== -1;
const hasURLParams = url.indexOf('?') !== -1;

// If the URL contains # or ?, we can assume they don't need to have the `?` token to start listing url parameters.
return `${CONFIG.EXPENSIFY.EXPENSIFY_URL}${url}${hasHashParams || hasURLParams ? '&' : '?'}authToken=${shortLivedAuthToken}&email=${encodeURIComponent(currentUserEmail)}`;
}

asyncOpenURL(DeprecatedAPI.GetShortLivedAuthToken(), buildOldDotURL);
Expand Down

0 comments on commit 3546820

Please sign in to comment.