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

Fix that a incorrect attachment could be selected

If an attachment with id 1234 and 12345 exists for the same task, the
12345 attachment could be selected for both.
parent 5a66148b
No related branches found
No related tags found
No related merge requests found
Pipeline #6290 passed with warnings
......@@ -68,7 +68,7 @@ function download() {
function download_attachment() {
local filename=""
if ! grep -q "^${1} ${2}" attachments/attachments.txt; then
if ! grep --quiet --max-count=1 "^${1} ${2} " attachments/attachments.txt; then
rm -fr "attachments/${1}/tmp"
mkdir -p "attachments/${1}/"{tmp,${2}}
cd "attachments/${1}/tmp"
......@@ -88,7 +88,7 @@ function download_attachment() {
rmdir tmp
cd ../../
else
filename="$(grep "^${1} ${2}" attachments/attachments.txt | cut -f3- -d " ")"
filename="$(grep --max-count=1 "^${1} ${2} " attachments/attachments.txt | cut -f3- -d " ")"
fi
# https://unix.stackexchange.com/a/33005
......
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