annna-message-common: select correct gopher type for filter output files - annn… | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 38df69c40972ad9b84ecb35c2813782eae03e8e7 | |
parent a1b00bb464e34317340b02422cb1af1e1024c336 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Mon, 21 Aug 2023 21:46:28 +0200 | |
annna-message-common: select correct gopher type for filter output files | |
Signed-off-by: Annna Robert-Houdin <[email protected]> | |
Diffstat: | |
M annna-message-common | 13 +++++++++++-- | |
1 file changed, 11 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/annna-message-common b/annna-message-common | |
@@ -1076,9 +1076,18 @@ case "${text}" in | |
# Cleanup if outpath file is empty. | |
[ -f "${outpath}" ] && [ ! -s "${outpath}" ] && rm "${outpath}" | |
+ # determine gopher type for output file | |
+ outmimetype="$(file -ib "${outpath}")" | |
+ case "$outmimetype" in | |
+ image/*) | |
+ outtype="I";; | |
+ *) | |
+ outtype="9";; | |
+ esac | |
+ | |
if [ -s "${outpath}" ]; | |
then | |
- annna-say -s "${server}" -c "${channel}" "${user}, gop… | |
+ annna-say -s "${server}" -c "${channel}" "${user}, gop… | |
exit 0 | |
fi | |
@@ -1109,7 +1118,7 @@ case "${text}" in | |
if [ -s "${outpath}" ]; | |
then | |
- annna-say -s "${server}" -c "${channel}" "${user}, gop… | |
+ annna-say -s "${server}" -c "${channel}" "${user}, gop… | |
fi | |
} & | |
exit 0 |