From 70a23c0d55f06d81a2ee7df49b319cb97011bf43 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Fri, 24 Jun 2022 13:27:18 +0200 Subject: [PATCH] added direct image link in share script --- share.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/share.sh b/share.sh index f2ba322..2ce3b7e 100755 --- a/share.sh +++ b/share.sh @@ -36,4 +36,10 @@ SLUG=$(curl -s -u "$API_USERNAME:$API_PASSWORD" -X POST --header "Content-Type --data "{\"key\":\"$UPLOAD_FILENAME\"}" \ "$ENDPOINT/api/share" | jq -r ".slug") -printf "%s/%s\n" "$ENDPOINT" "$SLUG" + +MIME=$(file -i -b "$UPLOAD_FILE") +if echo "$MIME" | grep "image" &> /dev/null; then + printf "%s/s/%s.%s\n" "$ENDPOINT" "$SLUG" "${UPLOAD_FILENAME##*.}" +else + printf "%s/%s\n" "$ENDPOINT" "$SLUG" +fi