fix(cmus): HTML formatting error on notification when text contains &

This commit is contained in:
Yorick Barbanneau 2025-02-03 23:18:45 +01:00
parent 31d15e6416
commit 63581953db

View file

@ -13,9 +13,9 @@ process_args() {
escape() {
local string
string=$1
string=${string//"&"/"&"}
string=${string//"<"/"&lt;"}
string=${string//">"/"&gt;"}
string=${string//"&"/"&amp;"}
printf "%s" "$string"
}
@ -46,7 +46,7 @@ main() {
if [[ ${#title} -gt 25 ]]; then
title="${title:0:24}"
fi
title="<b>$title</b>"
title="<b>$(escape "$title")</b>"
if [ -n "$artist" ]; then
if [[ ${#artist} -gt 22 ]]; then