Skip to content

Commit

Permalink
Merge pull request #23774 from eh2077/21266-try-catch-regex-execution…
Browse files Browse the repository at this point in the history
…-error

Fix: regex execution Maximum regex stack depth reached error
  • Loading branch information
bondydaa authored Aug 2, 2023
2 parents 15abe02 + 5066b2b commit b755df5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"date-fns-tz": "^2.0.0",
"dom-serializer": "^0.2.2",
"domhandler": "^4.3.0",
"expensify-common": "git+ssh://[email protected]/Expensify/expensify-common.git#98d8fea356f114f8b5b0cea889a41b355e5daf58",
"expensify-common": "git+ssh://[email protected]/Expensify/expensify-common.git#9940dd127c2d44809c98ee628a8057f08c93bfc9",
"fbjs": "^3.0.2",
"htmlparser2": "^7.2.0",
"jest-when": "^3.5.2",
Expand Down
10 changes: 9 additions & 1 deletion src/libs/Url.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ function addTrailingForwardSlash(url) {
*/
function getURLObject(href) {
const urlRegex = new RegExp(URL_WEBSITE_REGEX, 'gi');
const match = urlRegex.exec(href);
let match;
try {
if (!href.startsWith('mailto:')) {
match = urlRegex.exec(href);
}
} catch (e) {
// eslint-disable-next-line no-console
console.warn('Error parsing url in Url.getURLObject', {error: e});
}
if (!match) {
return {
href: undefined,
Expand Down

0 comments on commit b755df5

Please sign in to comment.