From 8a278f74e76c11f52050cd937d48e030bb383eba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serhat=20G=C3=BCl=C3=A7i=C3=A7ek?= Date: Thu, 31 Jan 2013 17:39:55 +0100 Subject: [PATCH] Mailing failed because of non-escaped slashes When trying to mail if one of the arguments contains a slash an empty mail would be send. This happens mostly if a postprocessing script is set. The fix is to show the filename only (not the full path). I couldn't get the slashes to escape properly. As the escaped string would have to be escaped as well before it's used and after a while I lost track of the amount of regular slashes and escaped slashes to use. --- nzbget-postprocessing-files/9.0/bin/nzbget-postprocess.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nzbget-postprocessing-files/9.0/bin/nzbget-postprocess.sh b/nzbget-postprocessing-files/9.0/bin/nzbget-postprocess.sh index f219b4ff..d1abe191 100644 --- a/nzbget-postprocessing-files/9.0/bin/nzbget-postprocess.sh +++ b/nzbget-postprocessing-files/9.0/bin/nzbget-postprocess.sh @@ -160,9 +160,9 @@ replaceVarBy() { # If we're not using Bash use sed, as we need to support as much as systems possible, also those running sh/dash etc if [ -n "${BASH_VERSION}" ]; then - REPLACEDRESULT="${1/${2}/${3}}" + REPLACEDRESULT="${1/${2}/${3##*/}}" # get last part after slash for paths else - REPLACEDRESULT=$(echo "${1}" | sed "s/${2}/${3}/") + REPLACEDRESULT=$(echo "${1}" | sed "s/${2}/${3##*/}/") # get last part after slash for paths fi if [ "$Debug" = "yes" ]; then echo "[DETAIL] Post-Process: replace result: ${REPLACEDRESULT}" ; fi