From c9ab7d4f49bc1b68671f7d09573faaf25282cc3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Tue, 27 Dec 2022 14:48:12 +0100 Subject: [PATCH] fix no content-type in source mbox --- src/bash/filter.sh | 7 +++++-- src/bash/filterTest.sh | 6 ++++-- src/cpp/MainAttachment.cpp | 2 ++ src/cpp/eMailShrinker.cpp | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) mode change 100755 => 100644 src/bash/filter.sh mode change 100755 => 100644 src/bash/filterTest.sh diff --git a/src/bash/filter.sh b/src/bash/filter.sh old mode 100755 new mode 100644 index dce2de3..98d5a66 --- a/src/bash/filter.sh +++ b/src/bash/filter.sh @@ -119,8 +119,11 @@ curlJirafeauSend () { # $3: content-type # $4: name # $5: password - LOG_FIC " - curl -X POST -F \"time=$1\" -F \"key=$5\" -F \"file=@$2;type=$3;filename=$4\" \"${JIRAFEAU_LOCAL}/a.php\"" - curl -X POST -F "time=$1" -F "key=$5" -F "file=@$2;type=$3;filename=$4" "${JIRAFEAU_LOCAL}/a.php" + + type=$3 + [ -z "${type}" ] && type="text/plain" + LOG_FIC " - curl -X POST -F \"time=$1\" -F \"key=$5\" -F \"file=@$2;type=${type};filename=$4\" \"${JIRAFEAU_LOCAL}/a.php\"" + curl -X POST -F "time=$1" -F "key=$5" -F "file=@$2;type=${type};filename=$4" "${JIRAFEAU_LOCAL}/a.php" } #################### MAIN ################################################# diff --git a/src/bash/filterTest.sh b/src/bash/filterTest.sh old mode 100755 new mode 100644 index f6fd624..85331dc --- a/src/bash/filterTest.sh +++ b/src/bash/filterTest.sh @@ -110,8 +110,10 @@ curlJirafeauSend () { # $4: name # $5: password - curl -X POST -F "time=$1" -F "key=$5" -F "file=@$2;type=$3;filename=$4" "${JIRAFEAU_LOCAL}/a.php" - #"${jirafeauAPI}" -f "${JIRAFEAU_LOCAL}" -t "$1" -s "1Gi" -c "$3" -n "$4" send "$2" "$5" + type=$3 + [ -z "${type}" ] && type="text/plain" + curl -X POST -F "time=$1" -F "key=$5" -F "file=@$2;type=${type};filename=$4" "${JIRAFEAU_LOCAL}/a.php" + #"${jirafeauAPI}" -f "${JIRAFEAU_LOCAL}" -t "$1" -s "1Gi" -c "${type}" -n "$4" send "$2" "$5" } ######################################## diff --git a/src/cpp/MainAttachment.cpp b/src/cpp/MainAttachment.cpp index a91c931..570ea9f 100644 --- a/src/cpp/MainAttachment.cpp +++ b/src/cpp/MainAttachment.cpp @@ -491,6 +491,8 @@ void MainAttachment::rewriteHeaders (ifstream &mbox, ofstream &outbox, const Hea boundary = "--"+boundary+"--"; boundaryMiddleSize = boundary.length () - 2; } + if (startPos >= mime.length ()) + startPos = mime.length ()-1; mime.insert (startPos, contentType); outbox << mime << flush; } diff --git a/src/cpp/eMailShrinker.cpp b/src/cpp/eMailShrinker.cpp index 2927608..cf76cd8 100644 --- a/src/cpp/eMailShrinker.cpp +++ b/src/cpp/eMailShrinker.cpp @@ -33,7 +33,7 @@ //////////////////////////////////////////////////////////////////////////// #include "version.hpp" -const std::string kaz::LAST_VERSION_NUM ("2.11"); +const std::string kaz::LAST_VERSION_NUM ("2.12"); const std::string kaz::LAST_VERSION_DATE ("2022-12-27"); const std::string kaz::LAST_VERSION (LAST_VERSION_NUM+" "+LAST_VERSION_DATE+" eMailShrinker");