summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changes2
-rw-r--r--urpm/download.pm13
2 files changed, 13 insertions, 2 deletions
diff --git a/Changes b/Changes
index 7fae79b0..3f148ceb 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,5 @@
+- library:
+ o fix download with curl 7.86+ when the URL has a query part (mga#31047)
- gurpmi2:
o fix Cancel button getting lost after first batch of downloads is done
diff --git a/urpm/download.pm b/urpm/download.pm
index b1ea6454..8ee2ba12 100644
--- a/urpm/download.pm
+++ b/urpm/download.pm
@@ -488,8 +488,8 @@ sub sync_curl {
#- options for http files, -R (-O <file>)*
my $result;
if (my @all_files = (
- (map { ("-O", $_) } @ftp_files),
- (map { m|/| ? ("-O", $_) : @{[]} } @other_files)))
+ (map { (_curl_output_option($_), $_) } @ftp_files),
+ (map { m|/| ? (_curl_output_option($_), $_) : @{[]} } @other_files)))
{
my @l = (@ftp_files, @other_files);
my $cmd = join(" ", map { "'$_'" } "/usr/bin/curl",
@@ -516,6 +516,15 @@ sub sync_curl {
$result;
}
+sub _curl_output_option {
+ my ($remote_file) = @_;
+ #- curl 7.86 changed the -O option to remove any trailing query part from the output
+ #- file name. So if we have a query part, use the -o option instead. If not, use the
+ #- -O option to avoid bloating the command line.
+ my $local_file = basename($remote_file);
+ $local_file =~ /\?/ ? ('-o', $local_file) : '-O';
+}
+
sub _curl_action {
my ($cmd, $options, @l) = @_;