Lookup API is unable to send records with a double quote character in their content
pavel-kalmykov opened this issue · comments
Right now, the Lookup.clean_field
method wraps the field's content in double quotes, unless it is a number:
python-sdk/devo/sender/lookup.py
Lines 400 to 414 in 84a4e2c
However, it does not check the existence of double quotes present in the field's value itself. This leads to a problem in which a code like this:
lookup.send_headers(headers=['KEY', 'VALUE'], key='KEY', event='START', action="INC")
lookup.send_data_line(key="11", fields=["11", 'double quote: "'])
lookup.send_headers(headers=['KEY', 'VALUE'], key='KEY', event='END', action="INC")
Makes the update process fail silently, without any notice from the client's perspective.
I think we need to ensure that double quotes are escaped by replacing them like this:
field.replace('"', '""')
Or at least inform in the documentation that double quotes need to be escaped with two double quotes.
We will follow both approaches: document this and allow the user to automatically escape the double quotes (through a parameters flag or something like that).