From 242a3162a07d744913323decdb317f26c06fbf70 Mon Sep 17 00:00:00 2001 From: Kyle Fuller Date: Mon, 2 Dec 2013 07:17:42 +0000 Subject: [PATCH] Don't replace spaces for %20 in URLs The markdown parser from John Gruber doesn't do this, and there is no mention of this in the specification. This is a broken implementation because it doesn't encode everything. Ie, there may already be a `%20` in the URL and a space. The original `%20` should become `%2520` and the space would already be turned into `%20`. If this should be percent encoding the URL's then it should use `urllib.quote` so it handles these cases and also encodes every other character. --- markdown/inlinepatterns.py | 1 - 1 file changed, 1 deletion(-) diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py index de957ef48..44eda9bf7 100644 --- a/markdown/inlinepatterns.py +++ b/markdown/inlinepatterns.py @@ -344,7 +344,6 @@ def sanitize_url(self, url): `username:password@host:port`. """ - url = url.replace(' ', '%20') if not self.markdown.safeMode: # Return immediately bipassing parsing. return url