tools/osbuild-depsolve-dnf(5): use url.path to drop scheme

str.removeprefix() is not available in Python 3.6, which we need to
support EL8.

Instead of removing the prefix from the original path string, take the
path property of the parsed URL.  Since we're dealing with file paths,
there will be no params, query, or fragment strings so the path should
be all we need.
This commit is contained in:
Achilleas Koutsou 2024-04-15 19:25:27 +02:00 committed by Michael Vogt
parent 7c04e1c596
commit 8b1e743120
2 changed files with 2 additions and 2 deletions

View file

@ -326,7 +326,7 @@ def read_keys(paths, root_dir=None):
for path in paths:
url = urllib.parse.urlparse(path)
if url.scheme == "file":
path = path.removeprefix("file://")
path = url.path
path = modify_rootdir_path(path, root_dir)
try:
with open(path, mode="r", encoding="utf-8") as keyfile:

View file

@ -468,7 +468,7 @@ def read_keys(paths, root_dir=None):
for path in paths:
url = urllib.parse.urlparse(path)
if url.scheme == "file":
path = path.removeprefix("file://")
path = url.path
path = modify_rootdir_path(path, root_dir)
try:
with open(path, mode="r", encoding="utf-8") as keyfile: