Pārlūkot izejas kodu

v2.3.6 - fix grep detection method fail on some rare cases, would make execution fail instead of fail-safing

master
Gustavo Arnosti Neves pirms 7 gadiem
vecāks
revīzija
cd99b8c2ba
1 mainītis faili ar 10 papildinājumiem un 9 dzēšanām
  1. +10
    -9
      pdfScale.sh

+ 10
- 9
pdfScale.sh Parādīt failu

@@ -12,7 +12,7 @@
# And: https://gist.github.com/MichaelJCole/86e4968dbfc13256228a


VERSION="2.3.5"
VERSION="2.3.6"


###################### EXTERNAL PROGRAMS #######################
@@ -1359,7 +1359,8 @@ getPageSizeCatGrep() {
# Get MediaBox data if possible
local mediaBox="$("$GREPBIN" -a -e '/MediaBox' -m 1 "$INFILEPDF" 2>/dev/null)"

mediaBox="${mediaBox##*/MediaBox}"
mediaBox="${mediaBox##*/MediaBox[}"
mediaBox="${mediaBox%%]*}"

# No page size data available
if isEmpty "$mediaBox" && isNotAdaptiveMode; then
@@ -1369,18 +1370,18 @@ getPageSizeCatGrep() {
fi

# remove chars [ and ]
mediaBox="${mediaBox//[}"
mediaBox="${mediaBox//]}"
#mediaBox="${mediaBox//[}"
#mediaBox="${mediaBox//]}"

mediaBox=($mediaBox) # make it an array
mbCount=${#mediaBox[@]} # array size

# sanity
if [[ $mbCount -lt 4 ]]; then
if isNotAdaptiveMode; then
notAdaptiveFailed $'Error when reading the page size!\nThe page size information is invalid!'
fi
return $FALSE
if [[ $mbCount -lt 4 ]] || ! isFloat "${mediaBox[2]}" || ! isFloat "${mediaBox[3]}"; then
if isNotAdaptiveMode; then
notAdaptiveFailed $'Error when reading the page size!\nThe page size information is invalid!'
fi
return $FALSE
fi

# we are done


Notiek ielāde…
Atcelt
Saglabāt