[22523] Fix path calculation#25479
Conversation
|
@situchan @francoisl Please review. |
| expect(Url.getPathFromURL('http://foo.bar/?q=Test%20URL-encoded%20stuff')).toEqual(''); | ||
| expect(Url.getPathFromURL('http://www.test.com/path?param=123#123')).toEqual('path'); | ||
| expect(Url.getPathFromURL('http://foo.bar/?q=Test%20URL-encoded%20stuff')).toEqual('?q=Test%20URL-encoded%20stuff'); | ||
| expect(Url.getPathFromURL('http://www.test.com/path?param=123#123')).toEqual('path?param=123'); |
There was a problem hiding this comment.
#123 should not be removed
| try { | ||
| const path = new URL(url).pathname; | ||
| const parsedUrl = new URL(url); | ||
| const path = parsedUrl.pathname + parsedUrl.search + parsedUrl.hash; |
There was a problem hiding this comment.
There should be better way to get full path just removing host. Can you research on that?
There was a problem hiding this comment.
@situchan We can obviously just slice the URL string and remove the host and just return the path but imo this is a better approach since we actually parse the URL to check if the URL is valid or not and also encodes some characters into valid URL characters like '%20'.
If we just slice the string and remove the host and return the rest of the string that isn't very efficient and that is how it was actually done previously.
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-08-18.at.9.26.07.PM.movScreen.Recording.2023-08-18.at.9.27.28.PM.movMobile Web - ChromeMobile Web - SafariDesktopiOSAndroid |
situchan
left a comment
There was a problem hiding this comment.
Looks good. Sorry for not catching this earlier.
cc: @francoisl
|
That should not be caused by this PR |
|
@ayazhussain79 you should have commented on #23143. Seems like that PR is related to your screenshot. |
|
Well thank you I thought it might be because of this PR. |
|
🚀 Deployed to staging by https://github.com/francoisl in version: 1.3.56-0 🚀
|
|
🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.56-24 🚀
|

Details
This PR is an extension of #24483 since we are using query parameters in attachment URLs and the previous implementation only catered pretty URLs and removed any query params in the path.
Fixed Issues
$ #22523
$ #24483 (comment)
PROPOSAL:
Original Proposal: #22523 (comment)
Proposal for this PR: #24483 (comment)
Tests
Offline tests
Same as above
QA Steps
Same as above
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Web
web.mov
Mobile Web - Chrome
mweb.chrome.mp4
Mobile Web - Safari
safari.mov
Desktop
desktop1.mov
iOS
ios.mov
Android
Android build is stuck locally and taking a long time.Will update once it is done.