Skip to content

Commit 5eb4cbc

Browse files
committed
Account for encoding in _get_direct_url
Modifies the method to strip out url-encoding of the file name as well as a better way to gather the path that avoids double slashes Closes-Bug: #2129687 Change-Id: Ia2d2c824c64fce4779d4e38eec155dc020a4ad7e Signed-off-by: Ian Watson <ianwatson92@hotmail.co.uk>
1 parent 8882c87 commit 5eb4cbc

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

kayobe/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import shutil
2525
import subprocess
2626
import sys
27+
from urllib.parse import unquote
28+
from urllib.parse import urlparse
2729

2830
from ansible.parsing.yaml.loader import AnsibleLoader
2931
import yaml
@@ -67,7 +69,7 @@ def _get_direct_url_if_editable(dist):
6769
url = direct_url_content['url']
6870
prefix = 'file://'
6971
if url.startswith(prefix):
70-
return url[len(prefix):]
72+
return unquote(urlparse(url).path)
7173

7274
return None
7375

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
fixes:
3+
- |
4+
Fixes a issue where the working directory contains symbols such
5+
as @.
6+
The previous behaviour tries to load files with url encoded symbols.
7+
`LP#2129687 <https://bugs.launchpad.net/kayobe/+bug/2129687>`__

0 commit comments

Comments
 (0)