Skip to content

pypad_glasscoder.py Crashes on Unicode Characters #23

@dklann

Description

@dklann

Platform

Ubuntu (Linux Mint 21.1, up to date)

glasscoder_pypad Version

2.0.1-1

Rivendell Version

4.1.0-1

Expected Behavior

A normal metadata update sent to GlassCoder from Rivendell.

Steps to Reproduce

Send metadata containing, for example, the © symbol. pypad_glasscoder.py exits with non-zero status.

Backtrace

Traceback (most recent call last):
  File "/usr/lib/rivendell/pypad/pypad_glasscoder.py", line 66, in <module>
    rcvr.start(sys.argv[1],int(sys.argv[2]))
  File "/usr/lib/python3/dist-packages/rivendellaudio/pypad.py", line 963, in start
    self.__pypad_Process(Update(jdata,self.__config_parser,rd_config))
  File "/usr/lib/python3/dist-packages/rivendellaudio/pypad.py", line 812, in __pypad_Process
    self.__pad_callback(pad)
  File "/usr/lib/rivendell/pypad/pypad_glasscoder.py", line 51, in ProcessPad
    r = requests.post(req_url, json=json.loads(req_data))
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid control character at: line 1 column 187 (char 186)

Additional Thoughts

I see in pypad.py where the JSON is escaped (def __escapeJson()), but it's not clear that this is the right place to address Unicode characters...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions