46e28b
From f93ac80a0b3e9017bf2c374b72126908a7f5cbde Mon Sep 17 00:00:00 2001
46e28b
From: David Tardon <dtardon@redhat.com>
46e28b
Date: Mon, 8 Aug 2022 13:42:51 +0200
46e28b
Subject: [PATCH] refactor(url-lib): write curl output directly to file
46e28b
46e28b
The redirection to stdout was originally added to workaround
46e28b
https://bugzilla.redhat.com/show_bug.cgi?id=989133 (curl would create no
46e28b
file if the source was empty), but I don't see that problem with current
46e28b
curl.
46e28b
46e28b
A nice side-effect of this change is that curl shows download progress.
46e28b
46e28b
(cherry picked from commit 1343d21d8c0d1f7239e27165e9c7633b504f777f)
46e28b
46e28b
Resolves: #2112475
46e28b
---
46e28b
 modules.d/45url-lib/url-lib.sh | 4 ++--
46e28b
 1 file changed, 2 insertions(+), 2 deletions(-)
46e28b
46e28b
diff --git a/modules.d/45url-lib/url-lib.sh b/modules.d/45url-lib/url-lib.sh
46e28b
index e88fbc14..b009fd09 100755
46e28b
--- a/modules.d/45url-lib/url-lib.sh
46e28b
+++ b/modules.d/45url-lib/url-lib.sh
46e28b
@@ -67,7 +67,7 @@ curl_fetch_url() {
46e28b
     echo "$url" > /proc/self/fd/0
46e28b
     if [ -n "$outloc" ]; then
46e28b
         # shellcheck disable=SC2086
46e28b
-        curl $curl_args --output - -- "$url" > "$outloc" || return $?
46e28b
+        curl $curl_args --output "$outloc" -- "$url" || return $?
46e28b
     else
46e28b
         local outdir
46e28b
         outdir="$(mkuniqdir /tmp curl_fetch_url)"
46e28b
@@ -101,7 +101,7 @@ ctorrent_fetch_url() {
46e28b
     echo "$url" > /proc/self/fd/0
46e28b
     if [ -n "$outloc" ]; then
46e28b
         # shellcheck disable=SC2086
46e28b
-        curl $curl_args --output - -- "$url" > "$torrent_outloc" || return $?
46e28b
+        curl $curl_args --output "$torrent_outloc" -- "$url" || return $?
46e28b
     else
46e28b
         local outdir
46e28b
         outdir="$(mkuniqdir /tmp torrent_fetch_url)"
46e28b