commit c1206935b4e71efac0d1203c95d722da6288e52b parent db50c8ed46d53adb04293fff85ab98746e8c1465 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Fri, 4 Dec 2020 07:06:03 +0100 upload: treat gph files as listings in url Diffstat:
M | .local/bin/upload | | | 30 | +++++++++++++++++------------- |
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/.local/bin/upload b/.local/bin/upload @@ -101,19 +101,23 @@ upload_file() { rsync -rz $progress --chmod=Fu=rw,Fog=r -e "ssh" "$infile" \ "${user}@${host}:${remotedir}/'$newbasename'" if [ "$gopher" = 1 ]; then - mime_type="$(file -ib "$infile")" - case "$mime_type" in - image/*) - type=I;; - text/*) - type=0;; - *shellscript*) - type=0;; - *html*) - type=0;; - *) - type=9;; - esac + if [ "${newbasename##*.}" = "gph" ]; then + type=1 + else + mime_type="$(file -ib "$infile")" + case "$mime_type" in + image/*) + type=I;; + text/*) + type=0;; + *shellscript*) + type=0;; + *html*) + type=0;; + *) + type=9;; + esac + fi url="gopher://${host}/${type}/${dir}/${newbasename}" else url="https://${host}/${dir}/${newbasename}"