From 01a7518b4b3cc739297e9bbb478befe8f743872f Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Mon, 6 Apr 2026 04:29:09 +0200 Subject: [PATCH] Sanitize after ascii and some gymnastics around newlines --- lib/files/getDestFile | 6 ++++-- lib/files/sanitizeFile | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/files/getDestFile b/lib/files/getDestFile index 5180c94..1578c8a 100644 --- a/lib/files/getDestFile +++ b/lib/files/getDestFile @@ -55,11 +55,13 @@ getDestFile() { destfile="${filename##*/}" destfile="${destfile%.*}" fi - destfile=$(sanitizeFile "$destfile") - destfile=${destfile//$'\n'/::AtOM:NewLine:SQL:Inline::} if (( ${destinationascii["$destination"]} )) then + destfile=${destfile//$'\n'/::AtOM:NewLine:SQL:Inline::} echo "$destfile" >&${toascii[1]} read -r -u${toascii[0]} destfile + destfile=${destfile//::AtOM:NewLine:SQL:Inline::/$'\n'} fi + destfile=$(sanitizeFile "$destfile") + destfile=${destfile//$'\n'/::AtOM:NewLine:SQL:Inline::} } diff --git a/lib/files/sanitizeFile b/lib/files/sanitizeFile index 164ca9b..3bd5b18 100644 --- a/lib/files/sanitizeFile +++ b/lib/files/sanitizeFile @@ -26,6 +26,9 @@ sanitizeFile() { string=${string/#+(.)/} string=${string/%+(.)/} fi + + # We can't have newlines either + string=${string//$'\n'/ } fi echo "$string" }