From 5eb4cbc6ffd4324501a82325e63c3b35aafe403d Mon Sep 17 00:00:00 2001 From: Ian Watson Date: Thu, 23 Oct 2025 14:47:25 +0100 Subject: [PATCH] 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 --- kayobe/utils.py | 4 +++- .../fix-working-dir-url-encoding-5f50d66547858e37.yaml | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fix-working-dir-url-encoding-5f50d66547858e37.yaml diff --git a/kayobe/utils.py b/kayobe/utils.py index b70cb1029..ff4c35ca0 100644 --- a/kayobe/utils.py +++ b/kayobe/utils.py @@ -24,6 +24,8 @@ import shutil import subprocess import sys +from urllib.parse import unquote +from urllib.parse import urlparse from ansible.parsing.yaml.loader import AnsibleLoader import yaml @@ -67,7 +69,7 @@ def _get_direct_url_if_editable(dist): url = direct_url_content['url'] prefix = 'file://' if url.startswith(prefix): - return url[len(prefix):] + return unquote(urlparse(url).path) return None diff --git a/releasenotes/notes/fix-working-dir-url-encoding-5f50d66547858e37.yaml b/releasenotes/notes/fix-working-dir-url-encoding-5f50d66547858e37.yaml new file mode 100644 index 000000000..a7ed09bd2 --- /dev/null +++ b/releasenotes/notes/fix-working-dir-url-encoding-5f50d66547858e37.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fixes a issue where the working directory contains symbols such + as @. + The previous behaviour tries to load files with url encoded symbols. + `LP#2129687 `__