Merge lp:~robru/friends/quote-urls into lp:friends
Status: | Merged |
---|---|
Approved by: | Ken VanDine |
Approved revision: | 173 |
Merged at revision: | 173 |
Proposed branch: | lp:~robru/friends/quote-urls |
Merge into: | lp:friends |
Diff against target: |
47 lines (+13/-1) 3 files modified
debian/changelog (+1/-0) friends/shorteners/base.py (+4/-1) friends/tests/test_shortener.py (+8/-0) |
To merge this branch: | bzr merge lp:~robru/friends/quote-urls |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ken VanDine | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Robert Bruce Park | Approve | ||
Review via email: mp+156100@code.launchpad.net |
Commit message
Properly quote long URLs when submitting them for shortening, so that they don't break in transit.
Description of the change
Ok, so while I was refactoring the url-shortening logic for trunk-next, I realized that we weren't quoting the URLs to be shortened, which was resulting in some pretty bad breakage in certain cases. For example, if the URL contained a plus-sign (such as the one you're looking at *right now*), the URL shortener would interpret that as a space, and then the shortened URL wouldn't point at the real URL you wanted, but at s/+/ / instead, which obviously breaks the link.
So I fixed that by running the URLs through urllib.parse.quote before submitting them for shortening, and I included a test case to ensure that the strings really are percent-encoded before going out over the wire.
Please merge this in time for raring!
FAILED: Continuous integration, rev:172 /code.launchpad .net/~robru/ friends/ quote-urls/ +merge/ 156100/ +edit-commit- message
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http:// jenkins. qa.ubuntu. com/job/ friends- ci/13/ jenkins. qa.ubuntu. com/job/ friends- raring- amd64-ci/ 13
Executed test runs:
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ friends- ci/13/rebuild
http://