-
Notifications
You must be signed in to change notification settings - Fork 8.5k
short url: ensure absolute path isn't persisted #6581
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
Conversation
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.
would like to see a test with urls that have basepaths, query strings, no hash, etc.
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.
👍
|
Can we add some validation server side? |
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 suggest using url.format()
|
jenkins, test it |
1 similar comment
|
jenkins, test it |
|
LGTM |
|
LGTM |
short url: ensure absolute path isn't persisted
[Commit 1] short url: ensure absolute path isn't persisted Original sha: a8c1305 Authored by Jonathan Budzenski <[email protected]> on 2016-03-18T20:02:53Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T15:57:16Z [Commit 2] [short url] use url.format when creating /goto link Original sha: 2a71673 Authored by Jonathan Budzenski <[email protected]> on 2016-03-21T14:09:04Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T15:57:16Z [Commit 3] [short url] Add tests for query strings, no hashes Original sha: 690a140 Authored by Jonathan Budzenski <[email protected]> on 2016-03-21T14:42:10Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T15:57:16Z [Commit 4] [short url] Cleanup Original sha: 49d297f Authored by Jonathan Budzenski <[email protected]> on 2016-03-21T15:09:35Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T15:57:16Z [Commit 5] [short url] Add server tests Original sha: a612a0e Authored by Jonathan Budzenski <[email protected]> on 2016-03-21T15:30:12Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T18:12:25Z
[Commit 1] short url: ensure absolute path isn't persisted Original sha: a8c1305 Authored by Jonathan Budzenski <[email protected]> on 2016-03-18T20:02:53Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T15:57:16Z [Commit 2] [short url] use url.format when creating /goto link Original sha: 2a71673 Authored by Jonathan Budzenski <[email protected]> on 2016-03-21T14:09:04Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T15:57:16Z [Commit 3] [short url] Add tests for query strings, no hashes Original sha: 690a140 Authored by Jonathan Budzenski <[email protected]> on 2016-03-21T14:42:10Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T15:57:16Z [Commit 4] [short url] Cleanup Original sha: 49d297f Authored by Jonathan Budzenski <[email protected]> on 2016-03-21T15:09:35Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T15:57:16Z [Commit 5] [short url] Add server tests Original sha: a612a0e Authored by Jonathan Budzenski <[email protected]> on 2016-03-21T15:30:12Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T18:12:25Z
[Commit 1] short url: ensure absolute path isn't persisted Original sha: a8c1305 Authored by Jonathan Budzenski <[email protected]> on 2016-03-18T20:02:53Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T15:57:16Z [Commit 2] [short url] use url.format when creating /goto link Original sha: 2a71673 Authored by Jonathan Budzenski <[email protected]> on 2016-03-21T14:09:04Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T15:57:16Z [Commit 3] [short url] Add tests for query strings, no hashes Original sha: 690a140 Authored by Jonathan Budzenski <[email protected]> on 2016-03-21T14:42:10Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T15:57:16Z [Commit 4] [short url] Cleanup Original sha: 49d297f Authored by Jonathan Budzenski <[email protected]> on 2016-03-21T15:09:35Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T15:57:16Z [Commit 5] [short url] Add server tests Original sha: a612a0e Authored by Jonathan Budzenski <[email protected]> on 2016-03-21T15:30:12Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T18:12:25Z
…/6127 [backport] PR #6581 to 4.x
[Commit 1] short url: ensure absolute path isn't persisted Original sha: a8c1305 Authored by Jonathan Budzenski <[email protected]> on 2016-03-18T20:02:53Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T15:57:16Z [Commit 2] [short url] use url.format when creating /goto link Original sha: 2a71673 Authored by Jonathan Budzenski <[email protected]> on 2016-03-21T14:09:04Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T15:57:16Z [Commit 3] [short url] Add tests for query strings, no hashes Original sha: 690a140 Authored by Jonathan Budzenski <[email protected]> on 2016-03-21T14:42:10Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T15:57:16Z [Commit 4] [short url] Cleanup Original sha: 49d297f Authored by Jonathan Budzenski <[email protected]> on 2016-03-21T15:09:35Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T15:57:16Z [Commit 5] [short url] Add server tests Original sha: a612a0e Authored by Jonathan Budzenski <[email protected]> on 2016-03-21T15:30:12Z Committed by Jonathan Budzenski <[email protected]> on 2016-03-21T18:12:25Z
…/6127 [backport] PR #6581 to 4.5
…es/6127 [backport] PR #6581 to 4.5.0
…/6127 [backport] PR #6581 to 4.4
The /shorten relative url was calculated by combing protocol, host, port, base url and removing the match from an absolute url. In cases when port was set to 443 or 80, the absolute url may not contain port causing the match to fail and resulting in absolute urls being persisted.
Instead of matching and removing, this parses the absolute url passed and constructs a relative url from the parts.
I changed shortenUrl to return an angular promise - I wasn't able to get past await when using $httpBackend to mock test responses.
Fixes #6127, although this is a different bug than the original issue.