-
Notifications
You must be signed in to change notification settings - Fork 136
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
Fix: error from executing url regex #559
Fix: error from executing url regex #559
Conversation
@allroundexperts Should I move methods Url.getURLObject and ValidationUtils.isValidWebsite from App to this repo? Or just add try/catch to handle them in the App repo? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eh2077 Can you please add tests for this?
@allroundexperts Added test |
@@ -86,7 +86,7 @@ export default class ExpensiMark { | |||
* @param textToCheck - Text to check | |||
*/ | |||
containsNonPairTag(textToCheck: string): boolean; | |||
extractLinksInMarkdownComment(comment: string): string[]; | |||
extractLinksInMarkdownComment(comment: string): string[] | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of undefined, lets return []
as it was doing previously?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@allroundexperts I tend to stick with return undefined
when exception occurs for the following reason. This method currently is only used by method getRemovedMarkdownLinks
which needs to call this method twice to do diff to get the removed links. My point here is to let method getRemovedMarkdownLinks
return empty array []
if any of the two links array is undefined
, which means don't remove links if any exception occurs. Does it make sense to you?
Let's say, there's a new comment with multiple links but one of them causes regex execution error, in this case, we return undefined
to skip removing any links. If we return []
for the new comment, then method getRemovedMarkdownLinks
will remove all links.
New comment
asjjssjdjdjdjdjdjjeiwiwiwowkdjdjdieikdjfidekjcjdkekejdcjdkeekcjcdidjjcdkekdiccjdkejdjcjxisdjjdkedncicdjejejcckdsijcjdsodjcicdkejdicdjejajasjjssjdjdjdjdjdjjeiwiwiwowkdjdjdieikdjfisjksksjsjssskssjskskssksksksksskdkddkddkdksskskdkdkdksskskskdkdkdkdkekeekdkddenejeodxkdndekkdjddkeemdjxkdenendkdjddekjcjdkekejdcjdkeekcjcdidjjcdkekdiccjdkejdjcjxisdjjdkedncicdjejejcckdsijcjdsodjcicdkejdicdjejajasjjssjdjdjdjdjdjjeiwiwiwowkdjdjdieikdjfidekjcjdkekejdcjdkeekcjcdidjjcdkekdiccjdkejdjcjxisdjjdkedncicdjejejcckdsijcjdsodjcicdkejdi.cdjd
www.google.com
www.expensify.com
Old comment
www.google.com
www.expensify.com
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will also be good to log the failure for tracking purposes!
Bump @eh2077 |
@allroundexperts Added log messages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only requesting a couple small changes to the error messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!
@allroundexperts I found an error when sending log to backend using Logger setting from this repo https://github.com/Expensify/expensify-common/blob/main/lib/Log.jsx It looks like that the App doesn't include the jQuery in the build. The logger from App repo seems working well https://github.com/Expensify/App/blob/main/src/libs/Log.js Any suggestions on how to fix this issue? cc @joelbettner |
@eh2077 But we're adding If this is something that can be fixed quickly, then lets try to address that within this PR. If not, then we can comment out the log statements and create a new issue for fixing this. @joelbettner Let us know your thoughts. |
@allroundexperts I dug the logging error stack and I feel it's a bit tricky. I also found that jQuery may not be able to use in native platform. So I think we can use |
All yours @joelbettner! |
Fixed Issues
$ Expensify/App#21266
Tests
QA
Same as test