Skip to content

Commit

Permalink
Do not append & to internal Expenisfy URLs that have a # symbol.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmlee101 committed Jun 14, 2022
1 parent a32065c commit a0cf4b2
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 a0cf4b2

Please sign in to comment.