|
|
58179d |
From 5e082d74b73bf1b3565cfd72a3e1ba7a45a00a8b Mon Sep 17 00:00:00 2001
|
|
|
58179d |
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hr=C3=A1zk=C3=BD?= <lhrazky@redhat.com>
|
|
|
58179d |
Date: Wed, 7 Sep 2022 14:40:32 +0200
|
|
|
58179d |
Subject: [PATCH 1/2] Pass whole URL in relativeUrl to PackageTarget for RPM
|
|
|
58179d |
URL download
|
|
|
58179d |
|
|
|
58179d |
The PackageTarget supports baseUrl and relativeUrl on the API, but then
|
|
|
58179d |
the relativeUrl is just a path fragment with no definition on whether it
|
|
|
58179d |
should be encoded. It's being passed unencoded paths from other places,
|
|
|
58179d |
and so there's a conditional encode (only if not full URL) in libdnf.
|
|
|
58179d |
|
|
|
58179d |
But full URLs are actually supported in relativeUrl (in that case
|
|
|
58179d |
baseUrl should be empty) and in that case the URL is expected to be
|
|
|
58179d |
encoded and is not encoded for the second time.
|
|
|
58179d |
|
|
|
58179d |
Hence, pass the full URL to relativeUrl instead of splitting it. We also
|
|
|
58179d |
need to decode the file name we store, as on the filesystem the RPM file
|
|
|
58179d |
name is also decoded.
|
|
|
58179d |
|
|
|
58179d |
= changelog =
|
|
|
58179d |
msg: Don't double-encode RPM URLs passed on CLI
|
|
|
58179d |
type: bugfix
|
|
|
58179d |
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103015
|
|
|
58179d |
---
|
|
|
58179d |
dnf/repo.py | 7 ++++---
|
|
|
58179d |
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
58179d |
|
|
|
58179d |
diff --git a/dnf/repo.py b/dnf/repo.py
|
|
|
58179d |
index ec1a2537..86fb2bf4 100644
|
|
|
58179d |
--- a/dnf/repo.py
|
|
|
58179d |
+++ b/dnf/repo.py
|
|
|
58179d |
@@ -47,6 +47,7 @@ import string
|
|
|
58179d |
import sys
|
|
|
58179d |
import time
|
|
|
58179d |
import traceback
|
|
|
58179d |
+import urllib
|
|
|
58179d |
|
|
|
58179d |
_PACKAGES_RELATIVE_DIR = "packages"
|
|
|
58179d |
_MIRRORLIST_FILENAME = "mirrorlist"
|
|
|
58179d |
@@ -295,7 +296,7 @@ class RemoteRPMPayload(PackagePayload):
|
|
|
58179d |
self.local_path = os.path.join(self.pkgdir, self.__str__().lstrip("/"))
|
|
|
58179d |
|
|
|
58179d |
def __str__(self):
|
|
|
58179d |
- return os.path.basename(self.remote_location)
|
|
|
58179d |
+ return os.path.basename(urllib.parse.unquote(self.remote_location))
|
|
|
58179d |
|
|
|
58179d |
def _progress_cb(self, cbdata, total, done):
|
|
|
58179d |
self.remote_size = total
|
|
|
58179d |
@@ -308,8 +309,8 @@ class RemoteRPMPayload(PackagePayload):
|
|
|
58179d |
|
|
|
58179d |
def _librepo_target(self):
|
|
|
58179d |
return libdnf.repo.PackageTarget(
|
|
|
58179d |
- self.conf._config, os.path.basename(self.remote_location),
|
|
|
58179d |
- self.pkgdir, 0, None, 0, os.path.dirname(self.remote_location),
|
|
|
58179d |
+ self.conf._config, self.remote_location,
|
|
|
58179d |
+ self.pkgdir, 0, None, 0, None,
|
|
|
58179d |
True, 0, 0, self.callbacks)
|
|
|
58179d |
|
|
|
58179d |
@property
|
|
|
58179d |
--
|
|
|
58179d |
2.37.3
|
|
|
58179d |
|