From f51dc3f7a377808cdb51c35bc923e4ecb5094c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Mon, 23 Jan 2023 14:09:08 +0100 Subject: [PATCH] upgrade filterTest (exit code) --- src/bash/filter.sh | 2 +- src/bash/filterTest.sh | 13 ++++++++----- src/cpp/MainAttachment.cpp | 2 +- src/cpp/eMailShrinker.cpp | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/bash/filter.sh b/src/bash/filter.sh index ec7452b..a1260ae 100755 --- a/src/bash/filter.sh +++ b/src/bash/filter.sh @@ -122,7 +122,7 @@ curlJirafeauSend () { 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\"" + 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" } diff --git a/src/bash/filterTest.sh b/src/bash/filterTest.sh index 74e3447..77981a9 100755 --- a/src/bash/filterTest.sh +++ b/src/bash/filterTest.sh @@ -113,7 +113,7 @@ curlJirafeauSend () { type=$3 [ -z "${type}" ] && type="text/plain" LOG "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" + curl -X POST -F "time=$1" -F "key=$5" -F "file=@$2;type=${type};filename=\"$4\"" "${JIRAFEAU_LOCAL}/a.php" || exit 1 #"${jirafeauAPI}" -f "${JIRAFEAU_LOCAL}" -t "$1" -s "1Gi" -c "${type}" -n "$4" send "$2" "$5" } @@ -144,7 +144,7 @@ done ######################################## # extraction des pièces jointes -"${eMailShrinker}" ${DEBUG} -s "5ki" -d "${TMP_DIR}/PJ" "${mbox}" > "${TMP_DIR}/PJ-name.txt" +"${eMailShrinker}" ${DEBUG} -s "5ki" -d "${TMP_DIR}/PJ" "${mbox}" > "${TMP_DIR}/PJ-name.txt" || exit 1 LOG " - ${BLUE}PJ-name: ${NC}" cat "${TMP_DIR}/PJ-name.txt" @@ -177,6 +177,7 @@ cat "${TMP_DIR}/PJ-name.txt" | { LOG " - ${RED}can't upload ${ATTACH_MEDIA} <${JIR_TOKEN}> <${JIR_CODE}>${NC}" cat "${TMP_DIR}/one.txt" >> "${TTY}" echo "url:" + exit 1 ;; * ) LOG " - ${GREEN} upload ${ATTACH_MEDIA}${NC}" @@ -190,7 +191,7 @@ cat "${TMP_DIR}/PJ-name.txt" | { if [ "${NB_ATTACH}" -gt 1 ]; then PASSWORD=$(apg -n 1 -m 12 -M cln) PASSWORD_MD5=$(echo -n ${PASSWORD} | ${MD5_CMD} | cut -d \ -f 1) - curlJirafeauSend "month" "${TMP_DIR}/archive-content.txt" "text/kaz_email_archive" "archive_content" "${PASSWORD}" 2>> "${TTY}" > "${TMP_DIR}/one.txt" + curlJirafeauSend "month" "${TMP_DIR}/archive-content.txt" "text/kaz_email_archive" "archive_content" "${PASSWORD}" 2>> "${TTY}" > "${TMP_DIR}/one.txt" || exit 1 cat "${TMP_DIR}/one.txt" | { read JIR_TOKEN read JIR_CODE @@ -198,6 +199,7 @@ cat "${TMP_DIR}/PJ-name.txt" | { "" | no | *Error* | \<* ) LOG " - ${RED}can't upload ${TMP_DIR}/archive-content.txt${NC}" echo "arch: bad" + exit 1 ;; * ) LOG " - ${GREEN} upload archive-content.txt${NC}" @@ -219,11 +221,12 @@ LOG " - ${GREEN}ATTACH_MODE: ${ATTACH_MODE}${NC}" ######################################## # substitution des pièces jointes par les codes fournis par jirafeau -cat "${TMP_DIR}/PJ-Keys.txt" | "${eMailShrinker}" ${DEBUG} ${ATTACH_MODE} -s "5ki" "${mbox}" "${TMP_DIR}/new-mbox" 2>> "${TTY}" +cat "${TMP_DIR}/PJ-Keys.txt" | "${eMailShrinker}" ${DEBUG} ${ATTACH_MODE} -s "5ki" "${mbox}" "${TMP_DIR}/new-mbox" 2>> "${TTY}" || exit 1 ######################################## # affichage de la structure à la fin LOG " - ${BLUE}new-mbox:${NC}" -"${eMailShrinker}" -l "${TMP_DIR}/new-mbox" 2>> "${TTY}" +"${eMailShrinker}" -l "${TMP_DIR}/new-mbox" 2>> "${TTY}" || exit 1 echo -e "\nresul in ${TMP_DIR}/new-mbox" +exit 0 diff --git a/src/cpp/MainAttachment.cpp b/src/cpp/MainAttachment.cpp index 63d9b1c..77188be 100644 --- a/src/cpp/MainAttachment.cpp +++ b/src/cpp/MainAttachment.cpp @@ -800,7 +800,7 @@ MainAttachment::substitute (ifstream &mbox, ofstream &outbox, const SizeArg &min } attachP->println (outbox, content); } else { - LOG_BUG (true, continue, "eMailShrinker: bug M8: can't change" << *attachP); + LOG_BUG (true, continue, "eMailShrinker: upload has failed, so can't change" << *attachP); } outbox.flush (); curPos = attachP->endPos; diff --git a/src/cpp/eMailShrinker.cpp b/src/cpp/eMailShrinker.cpp index 6adc0ca..262db0d 100644 --- a/src/cpp/eMailShrinker.cpp +++ b/src/cpp/eMailShrinker.cpp @@ -33,8 +33,8 @@ //////////////////////////////////////////////////////////////////////////// #include "version.hpp" -const std::string kaz::LAST_VERSION_NUM ("2.15"); -const std::string kaz::LAST_VERSION_DATE ("2023-01-22"); +const std::string kaz::LAST_VERSION_NUM ("2.16"); +const std::string kaz::LAST_VERSION_DATE ("2023-01-23"); const std::string kaz::LAST_VERSION (LAST_VERSION_NUM+" "+LAST_VERSION_DATE+" eMailShrinker"); #include