mirror of
https://github.com/the-sane/lug-helper.git
synced 2024-12-28 17:34:23 +00:00
encode spaces in download urls
This commit is contained in:
parent
85f4d64608
commit
d87c0e55df
@ -1107,8 +1107,8 @@ download_file() {
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Capture the arguments
|
# Capture the arguments and encode spaces in urls
|
||||||
download_url="$1"
|
download_url="${1// /%20}"
|
||||||
download_filename="$2"
|
download_filename="$2"
|
||||||
|
|
||||||
# Download the item to the tmp directory
|
# Download the item to the tmp directory
|
||||||
@ -1116,7 +1116,7 @@ download_file() {
|
|||||||
if [ "$use_zenity" -eq 1 ]; then
|
if [ "$use_zenity" -eq 1 ]; then
|
||||||
# Format the curl progress bar for zenity
|
# Format the curl progress bar for zenity
|
||||||
mkfifo "$tmp_dir/lugpipe"
|
mkfifo "$tmp_dir/lugpipe"
|
||||||
cd "$tmp_dir" && curl -#LO "$download_url" > "$tmp_dir/lugpipe" 2>&1 & curlpid="$!"
|
cd "$tmp_dir" && curl -#L "$download_url" -o "$download_filename" > "$tmp_dir/lugpipe" 2>&1 & curlpid="$!"
|
||||||
stdbuf -oL tr '\r' '\n' < "$tmp_dir/lugpipe" | \
|
stdbuf -oL tr '\r' '\n' < "$tmp_dir/lugpipe" | \
|
||||||
grep --line-buffered -ve "100" | grep --line-buffered -o "[0-9]*\.[0-9]" | \
|
grep --line-buffered -ve "100" | grep --line-buffered -o "[0-9]*\.[0-9]" | \
|
||||||
(
|
(
|
||||||
@ -1134,7 +1134,7 @@ download_file() {
|
|||||||
rm --interactive=never "${tmp_dir:?}/lugpipe"
|
rm --interactive=never "${tmp_dir:?}/lugpipe"
|
||||||
else
|
else
|
||||||
# Standard curl progress bar
|
# Standard curl progress bar
|
||||||
(cd "$tmp_dir" && curl -LO "$download_url")
|
(cd "$tmp_dir" && curl -#L "$download_url" -o "$download_filename")
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user