Skip to content
Snippets Groups Projects
Commit c654db96 authored by Kristian Klausen's avatar Kristian Klausen :tada:
Browse files

Fix error out when the attachment is named tmp

parent f057bdbf
No related branches found
No related tags found
No related merge requests found
Pipeline #6234 passed with warnings
......@@ -71,9 +71,9 @@ function download_attachment() {
return
fi
rm -fr "attachments/${1}/${2}/tmp"
mkdir -p "attachments/${1}/${2}/tmp"
cd "attachments/${1}/${2}/tmp"
rm -fr "attachments/${1}/tmp"
mkdir -p "attachments/${1}/"{tmp,${2}}
cd "attachments/${1}/tmp"
local user_agent
user_agent="albs ($(git rev-parse --short HEAD); https://gitlab.archlinux.org/archlinux/archlinux-bugs-snapshotter)"
......@@ -81,14 +81,14 @@ function download_attachment() {
--max-redirect 0 \
--user-agent="${user_agent}" \
--no-verbose \
"https://bugs.archlinux.org/?getfile=${2}" || { [[ ${?} = 3 ]] && echo "Error downloading attachment: ${2}" && cd ../../ && rmdir "${2}"{/tmp,} && cd ../../ && return; }
"https://bugs.archlinux.org/?getfile=${2}" || { [[ ${?} = 3 ]] && echo "Error downloading attachment: ${2}" && cd .. && rmdir tmp "${2}" && cd ../../ && return; }
local files=(*)
filename="${files[0]}"
cd ..
mv "tmp/${filename}" .
mv "tmp/${filename}" "${2}"
rmdir tmp
cd ../../../
cd ../../
# https://unix.stackexchange.com/a/33005
# shellcheck disable=SC2001
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment