Show More
@@ -192,7 +192,11 b' class GitRepository(BaseRepository):' | |||
|
192 | 192 | >>> GitRepository._check_url('git://example.com/\t') |
|
193 | 193 | Traceback (most recent call last): |
|
194 | 194 | ... |
|
195 | urllib.error.URLError: <urlopen error Invalid ...> | |
|
196 | ||
|
197 | The failure above will be one of, depending on the level of WhatWG support: | |
|
195 | 198 | urllib.error.URLError: <urlopen error Invalid whitespace character in path: '\t'> |
|
199 | urllib.error.URLError: <urlopen error Invalid url: 'git://example.com/ ' normalizes to 'git://example.com/'> | |
|
196 | 200 | """ |
|
197 | 201 | try: |
|
198 | 202 | parsed_url = urllib.parse.urlparse(url) |
@@ -204,6 +208,10 b' class GitRepository(BaseRepository):' | |||
|
204 | 208 | if os.path.isabs(url) and os.path.isdir(url): |
|
205 | 209 | return |
|
206 | 210 | |
|
211 | unparsed_url = urllib.parse.urlunparse(parsed_url) | |
|
212 | if unparsed_url != url: | |
|
213 | raise urllib.error.URLError("Invalid url: '%s' normalizes to '%s'" % (url, unparsed_url)) | |
|
214 | ||
|
207 | 215 | if parsed_url.scheme == 'git': |
|
208 | 216 | # Mitigate problems elsewhere with incorrect handling of encoded paths. |
|
209 | 217 | # Don't trust urllib.parse.unquote but be prepared for more flexible implementations elsewhere. |
General Comments 0
You need to be logged in to leave comments.
Login now