Browse Source

url-lib: fix fetch_url return value for dotfiles

If you do "fetch_url $url/.somefile", fetch_url would return failure,
because "$outdir/*" wouldn't match the file.

Use ls -A (which busybox ls supports) to actually find possible dotfiles
in the created output dir.

Signed-off-by: Will Woods <wwoods@redhat.com>
master
Will Woods 13 years ago committed by Harald Hoyer
parent
commit
ed293f6d0c
  1. 7
      modules.d/45url-lib/url-lib.sh

7
modules.d/45url-lib/url-lib.sh

@ -60,11 +60,8 @@ curl_fetch_url() { @@ -60,11 +60,8 @@ curl_fetch_url() {
curl $curl_args --output "$outloc" "$url" || return $?
else
local outdir="$(mkuniqdir /tmp curl_fetch_url)"
local cwd="$(pwd)"
cd "$outdir"
curl $curl_args --remote-name "$url" || return $?
cd "$cwd"
outloc="$(echo $outdir/*)"
( cd "$outdir"; curl $curl_args --remote-name "$url" || return $? )
outloc="$outdir/$(ls -A $outdir)"
fi
[ -f "$outloc" ] || return 253
echo "$outloc"

Loading…
Cancel
Save