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