Browse Source

Fix handling of filenames with spaces and ampersands

master
JustAnotherArchivist 3 years ago
parent
commit
18a3305e79
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      iasha1check

+ 1
- 1
iasha1check View File

@@ -3,7 +3,7 @@

identifier="$1"
escapedIdentifier="$(sed 's/[.[\*^$()+?{|]/\\&/g' <<<"${identifier}")"
readarray -t iasha1sums < <(curl -sL "https://archive.org/download/${identifier}/${identifier}_files.xml" | tr -d '\n' | grep -Po '<file .*?</file>' | grep 'source="original".*<sha1>' | sed 's,^.*name=",,; s,".*<sha1>, ,; s,</sha1>.*$,,' | grep -Pv "^${escapedIdentifier}"'(\.cdx\.(gz|idx)|_meta\.(sqlite|xml)) ' | awk '{ print $2 " " $1 }')
readarray -t iasha1sums < <(curl -sL "https://archive.org/download/${identifier}/${identifier}_files.xml" | tr -d '\n' | grep -Po '<file .*?</file>' | grep 'source="original".*<sha1>' | sed 's,^.*name=",,; s,".*<sha1>, ,; s,</sha1>.*$,,' | grep -Pv "^${escapedIdentifier}"'(\.cdx\.(gz|idx)|_meta\.(sqlite|xml)) ' | sed 's,&amp;,\&,g' | awk '{ print $NF " " substr($0, 1, length($0) - length($NF) - 1) }')

localFiles=()
while IFS= read -r -d $'\0' f; do localFiles+=("${f:2}"); done < <(find . -type f -print0)


Loading…
Cancel
Save