Drazzilb08 / daps

DAPS (Drazzilb's Arr PMM Scripts) A collection of useful scripts for media management and automation
MIT License
152 stars 31 forks source link

Invalid json for webhook on appdata backup #186

Closed GeneralPractitioner-GP closed 4 months ago

GeneralPractitioner-GP commented 4 months ago

Hi,

I noticed that some of the jokes result in invalid JSON as they contain double quotes.

Example

{
    "text": "Powered by: Drazzilb | A photon checks into a hotel. Receptionist: "May I take your bags sir?" Photon: "I don't have any bags, I'm travelling light.""
}

The double quotes should either be made single quotes or escaped

{
    "text": "Powered by: Drazzilb | A photon checks into a hotel. Receptionist: \"May I take your bags sir?\" Photon: \"I don't have any bags, I'm travelling light.\""
}

I've modified the joke line to be

joke=$(curl -s https://raw.githubusercontent.com/Drazzilb08/daps/master/jokes.txt | shuf -n 1 | sed 's/"/\\"/g')
Drazzilb08 commented 4 months ago

Good find. I'll add this in unless you want to slap a PR together.

GeneralPractitioner-GP commented 4 months ago

Made a PR :) https://github.com/Drazzilb08/daps/pull/187

Drazzilb08 commented 4 months ago

Merged it. Thanks a bunch