annna-message-common: select correct gopher type for filter output files - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit 38df69c40972ad9b84ecb35c2813782eae03e8e7 DIR parent a1b00bb464e34317340b02422cb1af1e1024c336 HTML Author: Anders Damsgaard <anders@adamsgaard.dk> 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 <annna@bitreich.org> Diffstat: M annna-message-common | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) --- DIR 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}, gophers://bitreich.org/9/memecache/filter/${outfile}" + annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/${outtype}/memecache/filter/${outfile}" exit 0 fi @@ -1109,7 +1118,7 @@ case "${text}" in if [ -s "${outpath}" ]; then - annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/9/memecache/filter/${outfile}" + annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/${outtype}/memecache/filter/${outfile}" fi } & exit 0