Skip to content

Commit 9c72756

Browse files
authored
Merge pull request #187 from GeneralPractitioner-GP/escape-double-quotes
2 parents 55f7538 + 609373e commit 9c72756

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

extra-scripts/backup_appdata.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -562,20 +562,20 @@ send_notification() {
562562
# Get a random joke from the specified file
563563
# Check if the webhook is for discord
564564
if [[ "$webhook" =~ ^https://discord\.com/api/webhooks/ ]]; then
565-
joke=$(curl -s https://raw.githubusercontent.com/Drazzilb08/daps/master/jokes.txt | shuf -n 1)
565+
joke=$(curl -s https://raw.githubusercontent.com/Drazzilb08/daps/master/jokes.txt | shuf -n 1 | sed 's/"/\\"/g')
566566
discord_common_fields
567567
bot_name="Notification Bot"
568568
# Call the discord_payload function to construct the payload
569569
if [ ${#new_container[@]} -gt 0 ]; then
570-
joke=$(curl -s https://raw.githubusercontent.com/Drazzilb08/daps/master/jokes.txt | shuf -n 1)
570+
joke=$(curl -s https://raw.githubusercontent.com/Drazzilb08/daps/master/jokes.txt | shuf -n 1 | sed 's/"/\\"/g')
571571
new_container_notification
572572
new_container_response=$(curl -s -H "Content-Type: application/json" -X POST -d "$payload" "$webhook")
573573
if [ "$dry_run" == "true" ]; then
574574
echo "$new_container_response"
575575
fi
576576
fi
577577
if [ ${#removed_containers[@]} -gt 0 ]; then
578-
joke=$(curl -s https://raw.githubusercontent.com/Drazzilb08/daps/master/jokes.txt | shuf -n 1)
578+
joke=$(curl -s https://raw.githubusercontent.com/Drazzilb08/daps/master/jokes.txt | shuf -n 1 | sed 's/"/\\"/g')
579579
removed_container_notification
580580
removed_container=$(curl -s -H "Content-Type: application/json" -X POST -d "$payload" "$webhook")
581581
if [ "$dry_run" == "true" ]; then
@@ -594,19 +594,19 @@ send_notification() {
594594
fi
595595
# Check if the webhook is for notifiarr
596596
if [[ $webhook =~ ^https://notifiarr\.com/api/v1/notification/passthrough ]]; then
597-
joke=$(curl -s https://raw.githubusercontent.com/Drazzilb08/daps/master/jokes.txt | shuf -n 1)
597+
joke=$(curl -s https://raw.githubusercontent.com/Drazzilb08/daps/master/jokes.txt | shuf -n 1 | sed 's/"/\\"/g')
598598
notifiarr_common_fields
599599
# Call the notifiarr_payload function to construct the payload
600600
if [ ${#new_container[@]} -gt 0 ]; then
601-
joke=$(curl -s https://raw.githubusercontent.com/Drazzilb08/daps/master/jokes.txt | shuf -n 1)
601+
joke=$(curl -s https://raw.githubusercontent.com/Drazzilb08/daps/master/jokes.txt | shuf -n 1 | sed 's/"/\\"/g')
602602
new_container_notification
603603
new_container_response=$(curl -s -H "Content-Type: application/json" -X POST -d "$payload" "$webhook")
604604
if [ "$dry_run" == "true" ]; then
605605
echo "$new_container_response"
606606
fi
607607
fi
608608
if [ ${#removed_containers[@]} -gt 0 ]; then
609-
joke=$(curl -s https://raw.githubusercontent.com/Drazzilb08/daps/master/jokes.txt | shuf -n 1)
609+
joke=$(curl -s https://raw.githubusercontent.com/Drazzilb08/daps/master/jokes.txt | shuf -n 1 | sed 's/"/\\"/g')
610610
removed_container_notification
611611
removed_container=$(curl -s -H "Content-Type: application/json" -X POST -d "$payload" "$webhook")
612612
if [ "$dry_run" == "true" ]; then

extra-scripts/backup_folder.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ send_notification() {
202202
# Get current time in UTC format
203203
get_ts=$(date -u -Iseconds)
204204
# Get a random joke from the specified file
205-
joke=$(curl -s https://raw.githubusercontent.com/Drazzilb08/daps/master/jokes.txt | shuf -n 1)
205+
joke=$(curl -s https://raw.githubusercontent.com/Drazzilb08/daps/master/jokes.txt | shuf -n 1 | sed 's/"/\\"/g')
206206
# Check if the webhook is for discord
207207
if [[ $webhook =~ ^https://discord\.com/api/webhooks/ ]]; then
208208
# Call the discord_payload function to construct the payload

extra-scripts/backup_plex.sh

+1-5
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,7 @@ field_builder() {
223223
build_payload(){
224224
get_ts=$(date -u -Iseconds)
225225
# Get a random joke from the specified file
226-
joke=$(curl -s https://raw.githubusercontent.com/Drazzilb08/daps/master/jokes.txt | shuf -n 1)
227-
# ensure joke is valid for json
228-
# shellcheck disable=SC2001
229-
joke=$(echo "$joke" | sed 's/"/\\"/g')
230-
# ensure jokes is valid for json
226+
joke=$(curl -s https://raw.githubusercontent.com/Drazzilb08/daps/master/jokes.txt | shuf -n 1 | sed 's/"/\\"/g')
231227
if [[ $webhook =~ ^https://discord\.com/api/webhooks/ ]]; then
232228
bot_name="Notification Bot"
233229
title="name"

schemas/config-schema.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,10 @@
466466
},
467467
"ignore_media":
468468
{
469-
"type":"string"
469+
"type": [
470+
"array",
471+
"null"
472+
]
470473
},
471474
"ignore_collections": {
472475
"$ref": "#/definitions/uniqueArray"

0 commit comments

Comments
 (0)