Resolve "filename sanitization can fail with ascii-only target"

This commit is contained in:
ScriptFanix 2026-04-06 04:43:43 +02:00
parent 6d9321319b
commit 60cd9f0e88
2 changed files with 7 additions and 2 deletions

View File

@ -55,11 +55,13 @@ getDestFile() {
destfile="${filename##*/}" destfile="${filename##*/}"
destfile="${destfile%.*}" destfile="${destfile%.*}"
fi fi
destfile=$(sanitizeFile "$destfile")
destfile=${destfile//$'\n'/::AtOM:NewLine:SQL:Inline::}
if (( ${destinationascii["$destination"]} )) if (( ${destinationascii["$destination"]} ))
then then
destfile=${destfile//$'\n'/::AtOM:NewLine:SQL:Inline::}
echo "$destfile" >&${toascii[1]} echo "$destfile" >&${toascii[1]}
read -r -u${toascii[0]} destfile read -r -u${toascii[0]} destfile
destfile=${destfile//::AtOM:NewLine:SQL:Inline::/$'\n'}
fi fi
destfile=$(sanitizeFile "$destfile")
destfile=${destfile//$'\n'/::AtOM:NewLine:SQL:Inline::}
} }

View File

@ -26,6 +26,9 @@ sanitizeFile() {
string=${string/#+(.)/} string=${string/#+(.)/}
string=${string/%+(.)/} string=${string/%+(.)/}
fi fi
# We can't have newlines either
string=${string//$'\n'/ }
fi fi
echo "$string" echo "$string"
} }