Skip to content
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

handle space in path or query #23

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ python:
- "2.7"
- "3.4"
install:
- "pip install . --use-mirrors"
- "pip install ."
script: nosetests
sudo: false
3 changes: 3 additions & 0 deletions pylinkvalidator/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ def test_clean_url_split(self):
self.assertEqual(
"http://www.example.com/",
get_clean_url_split("http://www.example.com/").geturl())
self.assertEqual(
"http://www.example.com/media%20gallery",
get_clean_url_split("http://www.example.com/media gallery").geturl())

def test_get_absolute_url(self):
base_url_split = get_clean_url_split(
Expand Down
2 changes: 1 addition & 1 deletion pylinkvalidator/urlutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def url_encode_non_ascii(url_part):
return re.sub(
b'[\x80-\xFF]',
lambda match: quote(match.group(0)).encode("utf-8"),
url_part.encode("utf-8")).decode("ascii")
url_part.encode("utf-8")).decode("ascii").replace(' ', '%20') # handle space char in query


def get_absolute_url_split(url, base_url_split):
Expand Down