Update scnsend script: "bugfix for big files in --scnsend-read-body-from-file"

This commit is contained in:
2023-12-31 15:15:27 +01:00
parent 35a97be4c4
commit 0bc064b4ba
3 changed files with 16 additions and 9 deletions

View File

@@ -87,6 +87,7 @@ title="${args[0]}"
args=("${args[@]:1}")
content=""
filecontent=""
if [ ${#args[@]} -gt 0 ]; then
content="${args[0]}"
@@ -106,7 +107,8 @@ fi
if [[ "$content" == --scnsend-read-body-from-file=* ]]; then
path="$( awk '{ print substr($0, 31) }' <<< "$content" )"
content="$( cat "$path" )"
filecontent="$path"
content=""
fi
curlparams=()
@@ -121,6 +123,10 @@ if [[ -n "$content" ]]; then
curlparams+=("--data-urlencode" "content=$content")
fi
if [[ -n "$filecontent" && -z "$content" ]]; then
curlparams+=("--data-urlencode" "content@$filecontent")
fi
if [[ -n "$priority" ]]; then
curlparams+=("--data-urlencode" "priority=$priority")
fi