Merge pull request #851 from eikek/fix/older-jq-for-scripts

Don't use jq to clean whitespace/quotes
This commit is contained in:
mergify[bot] 2021-06-03 19:31:13 +00:00 committed by GitHub
commit ea97e0c60e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -150,7 +150,7 @@ downloadAttachment() {
DL_URL="$ATTACH_URL/$attachId"
checksum1=$("$CURL_CMD" -s -I -H "X-Docspell-Auth: $auth_token" "$DL_URL" | \
grep -i 'etag' | cut -d' ' -f2 | "$JQ_CMD" -r)
grep -i 'etag' | cut -d' ' -f2 | xargs | tr -d '\r')
"$CURL_CMD" -s -o "$attachOut" -H "X-Docspell-Auth: $auth_token" "$DL_URL"
checksum2=$(sha256sum "$attachOut" | cut -d' ' -f1 | xargs)
if [ "$checksum1" == "$checksum2" ]; then

View File

@ -178,7 +178,7 @@ downloadAttachment() {
fi
checksum1=$("$CURL_CMD" -s -I -H "X-Docspell-Auth: $auth_token" "$ATTACH_URL/$attachId/original" | \
grep -i 'etag' | cut -d' ' -f2 | "$JQ_CMD" -r)
grep -i 'etag' | cut -d':' -f2 | xargs | tr -d '\r')
"$CURL_CMD" -s -o "$attachOut" -H "X-Docspell-Auth: $auth_token" "$ATTACH_URL/$attachId/original"
checksum2=$(sha256sum "$attachOut" | cut -d' ' -f1 | xargs)
if [ "$checksum1" == "$checksum2" ]; then
@ -212,15 +212,13 @@ downloadItem() {
errout " - Removing metadata.json as requested"
rm -f "$out/metadata.json"
fi
echo $itemData | "$JQ_CMD" > "$out/metadata.json"
echo $itemData > "$out/metadata.json"
fi
while read attachId attachName; do
attachOut="$out/$attachName"
checkLogin
downloadAttachment "$attachId"
done < <(echo $itemData | "$JQ_CMD" -r '.sources[] | [.id,.name] | join(" ")')
}
login