Correctly escape special characters in RSS feed URLs #490

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

@grischard

As discussed on IRC. Some RSS clients (e.g. NetNewsWire) choke on special characters in URLs.

The problem I'm fixing can be demonstrated by running ` curl http://www.reddit.com/r/stereotest/.rss | grep -o -E http://.+?müllers '. The URLs should contain m%C3%BCllers instead of müllers.

This patch tells quote_plus to urlencode the url strings' special characters to their UTF8 code, unless they are the safe characters ':' or '/'.

@grischard grischard Correctly escape special characters in RSS feed URLs, as discussed on…
… IRC. Some RSS clients choke on special characters in URLs.
846d196
@spladug spladug commented on the diff Aug 13, 2012
r2/r2/templates/link.xml
@@ -32,6 +33,7 @@
url = thing.mousedown_url
else:
url = permalink
+ url = quote_plus(url.encode('utf8'), '/:')
@spladug
spladug Aug 13, 2012 reddit member

I think this would incorrectly urlencode the domain component of a URL with internationalized domain name, wouldn't it?

@spladug
Member
spladug commented Aug 13, 2012

Side note: we generally try to stick to the convention on how git commit messages should look. Would you mind fixing up your commit message, please?

@grischard

Indeed, I hadn't thought of IDNs at all, so I'll test that, and come back with a properly formatted git commit message. Thank you.

@Deimos
Deimos commented Jun 12, 2013

There haven't been any updates to this pull in a very long time, so I'm going to close it. Please submit a new pull request if you want to reopen it.

@Deimos Deimos closed this Jun 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment