Fix making posts sans media

This commit is contained in:
Jaidyn Ann 2023-08-06 23:00:07 -05:00
parent 6e78e53b08
commit 92b9476c87

View File

@ -23,9 +23,8 @@ file_status() {
local file="$1" local file="$1"
local id="$(head -1 "$file" | awk '{print $3}')" local id="$(head -1 "$file" | awk '{print $3}')"
local url="$(head -1 "$file" | awk '{print $4}')" local url="$(head -1 "$file" | awk '{print $4}')"
tail +4 "$file" \ tail +2 "$file" \
| sanitize_text \ | sanitize_text
| grep -v "$id"
if test -n "$url"; then if test -n "$url"; then
printf '<br/>[<a href=\\"%s\\">Originala afiŝo</a>]\\n' "$url" printf '<br/>[<a href=\\"%s\\">Originala afiŝo</a>]\\n' "$url"
fi fi
@ -35,12 +34,16 @@ file_status() {
# Turns a space-delimited list of uploaded media-IDs into a JSON array. # Turns a space-delimited list of uploaded media-IDs into a JSON array.
media_json() { media_json() {
local ids="$1" local ids="$1"
echo "$ids" \ if test -n "$ids"; then
| sed 's%^ %%' \ echo "$ids" \
| sed 's% $%%' \ | sed 's%^ %%' \
| sed 's%^%["%' \ | sed 's% $%%' \
| sed 's% %","%g' \ | sed 's%^%["%' \
| sed 's%$%"]%' | sed 's% %","%g' \
| sed 's%$%"]%'
else
echo ""
fi
} }