I have a Bash script which executes the following command on my Synology. It's supposed to use the Synology API to save my YouTube stream key to the Synology's "Live Broadcast" widget. It's works fine most of the time. (Note that the cookies file is dealt with in a separate command which pre-authenticates with the API)
This works fine, the full key is saved to the widget:
wget -qO- --load-cookies wgetcookies.txt --timeout=10 "http://localhost:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.YoutubeLive&method=Save&version=1&key=abcd-abcd-abcd-abcd-abcd"
However, if the first four digits of the "key" are decimals (no letters) then it has a weird failure mode; only the first four digits get saved. For example, this causes the widget to merely save "1234" as its key, instead of the whole key:
wget -qO- --load-cookies wgetcookies.txt --timeout=10 "http://localhost:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.YoutubeLive&method=Save&version=1&key=1234-1234-1234-1234-1234"
Comparing two similar commands, I discover that the first digit group of the key must contain at least one letter for it to save correctly. Examples:
Works:
wget -qO- --load-cookies wgetcookies.txt --timeout=10 "http://localhost:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.YoutubeLive&method=Save&version=1&key=3a56-9470-9470-9470-9470"
Fails:
wget -qO- --load-cookies wgetcookies.txt --timeout=10 "http://localhost:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.YoutubeLive&method=Save&version=1&key=3456-9470-9470-9470-9470"
Is this some kind of a bug in Wget where it's not interpreting the parameters correctly? Some weird thing about how it processes command line parameters that I don't understand? I've sometimes seen numeric representations in Powershell get weird where it interprets a number as Octal if it start with a zero in some cases. I wonder if this is something along those lines like that?
Because if it's not Wget, then it must be a bug in the Synology API. I'm just wondering if anyone recognizes this as a known issue in Wget or something.
Note: Every time, the API returns "{"success":true}", even in the failure cases. So the API thinks I'm submitting a good string every time. Also, URL-encoding the key, either by replacing the dashes with %2D or even replacing every digit with a URL escape code, doesn't solve the problem. Surrounding the key with single quotes, like &key='1234-1234-1234-1234-1234' causes the full key to be saved, but also the single quotes get saved too, so that isn't a successful workaround.
Any ideas?
Thanks!