Skip to content

Commit

Permalink
Merge pull request #17140 from allroundexperts/fix-16520
Browse files Browse the repository at this point in the history
fix: added excluded paths for navigation
  • Loading branch information
puneetlath authored Apr 11, 2023
2 parents d412981 + 875193c commit b041f49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -2197,6 +2197,9 @@ const CONST = {
SAMPLE_INPUT: '123456.789',
EXPECTED_OUTPUT: 'FCFA 123,457',
},
PATHS_TO_TREAT_AS_EXTERNAL: [
'NewExpensify.dmg',
],
};

export default CONST;
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const AnchorRenderer = (props) => {
const attrHref = htmlAttribs.href || '';
const attrPath = lodashGet(Url.getURLObject(attrHref), 'path', '').replace('/', '');
const hasExpensifyOrigin = Url.hasSameExpensifyOrigin(attrHref, CONFIG.EXPENSIFY.EXPENSIFY_URL) || Url.hasSameExpensifyOrigin(attrHref, CONFIG.EXPENSIFY.STAGING_API_ROOT);
const internalNewExpensifyPath = (Url.hasSameExpensifyOrigin(attrHref, CONST.NEW_EXPENSIFY_URL) || Url.hasSameExpensifyOrigin(attrHref, CONST.STAGING_NEW_EXPENSIFY_URL)) && attrPath;
const internalNewExpensifyPath = (Url.hasSameExpensifyOrigin(attrHref, CONST.NEW_EXPENSIFY_URL) || Url.hasSameExpensifyOrigin(attrHref, CONST.STAGING_NEW_EXPENSIFY_URL))
&& !CONST.PATHS_TO_TREAT_AS_EXTERNAL.includes(attrPath) ? attrPath : '';
const internalExpensifyPath = hasExpensifyOrigin
&& !attrPath.startsWith(CONFIG.EXPENSIFY.CONCIERGE_URL_PATHNAME)
&& attrPath;
Expand Down Expand Up @@ -99,7 +100,7 @@ const AnchorRenderer = (props) => {
key={props.key}
displayName={displayName}

// Only pass the press handler for internal links, for public links fallback to default link handling
// Only pass the press handler for internal links. For public links or whitelisted internal links fallback to default link handling
onPress={(internalNewExpensifyPath || internalExpensifyPath) ? navigateToLink : undefined}
>
<TNodeChildrenRenderer tnode={props.tnode} />
Expand Down

0 comments on commit b041f49

Please sign in to comment.