浏览代码

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

master
父节点
当前提交
cd99b8c2ba
共有 1 个文件被更改,包括 10 次插入9 次删除
  1. +10
    -9
      pdfScale.sh

+ 10
- 9
pdfScale.sh 查看文件

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




VERSION="2.3.5"
VERSION="2.3.6"




###################### EXTERNAL PROGRAMS ####################### ###################### EXTERNAL PROGRAMS #######################
@@ -1359,7 +1359,8 @@ getPageSizeCatGrep() {
# Get MediaBox data if possible # Get MediaBox data if possible
local mediaBox="$("$GREPBIN" -a -e '/MediaBox' -m 1 "$INFILEPDF" 2>/dev/null)" 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 # No page size data available
if isEmpty "$mediaBox" && isNotAdaptiveMode; then if isEmpty "$mediaBox" && isNotAdaptiveMode; then
@@ -1369,18 +1370,18 @@ getPageSizeCatGrep() {
fi fi


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


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


# sanity # 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 fi


# we are done # we are done


正在加载...
取消
保存