Allow tilde (~) in url parameters#533
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
There was a problem hiding this comment.
@huzaifa-99 Can you please add test video as well?
Along with the list of valid urls, please add following steps in Tests:
- Send a valid url
- Verify that the sent url appears as a valid url(blue and underlined)
- Verify hovering over the url shows the tooltip in Web and Desktop
- Verify that Right click (Web and Desktop) or long press (mWeb and native) shows Copy Url to Clipboard context menu
- Edit the sent url
- Verify steps 2-4
I don't think this PR at this moment will be sufficient to solve the case of \\.
|
|
||
| const ALLOWED_PORTS = '([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])'; | ||
| const URL_PROTOCOL_REGEX = '((ht|f)tps?:\\/\\/)'; | ||
| const URL_PROTOCOL_REGEX = '((ht|f)tps?:[\\/|\\\\]{2})'; |
There was a problem hiding this comment.
Are you sure it is the right way to do it?
I am not an expert on regex. But I think you might have to use ( instead of [ with disjunction. I think something like
(?:\\/{2}|\\\\{2}) should do the job.
There was a problem hiding this comment.
I accidently removed the second \\/, mb
There was a problem hiding this comment.
Apologies, maybe i didn't understand your comment properly. The \\/ was intentional. I will test (?:\\/{2}|\\\\{2}) with some urls and update.
There was a problem hiding this comment.
Your change will accept https:/\google.com and https:||google.com as valid url not only https:\\google.com
There was a problem hiding this comment.
Ah yes, Thank you @sobitneupane!. I have updated with (?:\\/{2}|\\\\{2}) as you suggested.
There was a problem hiding this comment.
There was another place in my changes that used \\/|\\\\, fixed here
@sobitneupane just to confirm on next steps here. Should I exclude this changes for the PR? and add test for |
|
Nope. I don't mean that. I mean some other changes might be required within this repo (probably here) or in Expensify/App repo. Did you find any issue in the PR? At the present state, I don't think PR will pass these tests. |
|
Didn't knew about the tooltip hover, thanks @sobitneupane!. Will check the required changes and post here soon. |
|
@sobitneupane this looks like an issue with the api. Api will recognise backslashes in some areas of the url as valid while not matching others. In my tests, I found these urls (with backslashes) are recognised as valid by the api (and these work with tooltips/pressables) while these ones fail So summarising from this, API recognises backslashes when in query params or the path but not in the domain part. Why it failsWith backslashes after the protocol or the trailing backslash after the TLD, the api responds like this. Notice that the anchor tag in the html key has no href prop. For other urls the api will add the href prop I also tried turning off internet. The failing urls (with backslash in domain part and trailing backslash after TLD) work when not connected to the internet, when connection is restored the api updates and it breaks the links for urls that have backslash after protocol part or the trailing backslash after TLD Offline testScreen.Recording.2023-05-12.at.5.51.47.PM.movDemo to prove above statementsDemo.URL.Backslashes-compressed.mp4Also just for clarification, I used the same changes in this PR. @PauloGasparSv @sobitneupane Can you please guide me on the next steps? Should we wait/hold on a change in API or just proceed with the changes in this PR? |
|
I will add tests soon after your response @sobitneupane |
Oh yes. Looks like backend is returning anchor without href. cc: @PauloGasparSv Update: I just noticed that |
@sobitneupane I found another case
|
@sobitneupane just to confirm if i should add tests with |
|
Let's wait for @PauloGasparSv's opinion on #533 (comment) |
|
Sure thanks!. Just to add to the convo, i noticed that slack doesn't allow
|
|
I'm still trying to find time today to take a look at the API and into this.
That's really good to know! Whatsapp does allow Taking in consideration that:
I think we shouldn't bother with making Does that sound good @sobitneupane @huzaifa-99? |
|
Btw, thks for all the work here so far! |
|
Thank you for the input @PauloGasparSv
Sounds good to me! |
|
@huzaifa-99 Please let me know when it is ready for review. Looks like you need to remove |
|
@sobitneupane tests are added for all platforms, PR is ready. Please let me know if any issues. |
|
@sobitneupane bump ^ |
|
Thank you @sobitneupane 🎉 |
PauloGasparSv
left a comment
There was a problem hiding this comment.
LGTM, tested changes on Web locally!
Will test and evidences to each platform on the App P.R.
|
Ah apologies @PauloGasparSv. Should I create a new PR and close this one out. I could also force push a fresh commit and remove existing ones? These are not good enough options but not sure on what's the next step. Update: I just found out there is an option to sign previous commits but never done it. Will try and update here soon |
|
Don't worry @huzaifa-99!
Thks for that!!!! I also searched a bit and asked for help internally, do you mind trying to:
Can you please do that and ping us @huzaifa-99? |
a683fca to
5318124
Compare
5318124 to
2f762d9
Compare
|
@PauloGasparSv Thank you (and the team) for the solution. I tried the command, it worked but I had to use the hash of previous commit (the commit before my unsigned commit). Anyways a lesson learned and got to know an existing commit can be signed as well. Thanks again! |
|
@sobitneupane @PauloGasparSv I am not sure if i should make a PR in Expensify/App as there is already one Expensify/App#18994 that applies my commits as well. Please let me know on the next steps. Thanks! |
|
I don't think you should create another PR if there is already one which includes commit latest than yours. cc: @PauloGasparSv |
|
sure, Thank you! |









Fixed Issues
$ Expensify/App/issues/18564
Tests
Verify if
~works in query paramsExamples:
QA
Same as tests
Screenshots/Videos
Web
Safari
web.safari.mov
Chrome
web.chrome.mov
Mobile Web - Chrome
Mweb.Chrome.mp4
Mobile Web - Safari
ios.safari.mov
Desktop
desktop.mov
iOS
Screen.Recording.2023-05-12.at.9.39.02.PM.mov
Android
Android.Native.mp4