monday icon indicating copy to clipboard operation
monday copied to clipboard

Double quote (") in item name will fail to create the item

Open binairo opened this issue 4 years ago • 0 comments

When creating an item through the API, the item name is specified as a separate argument:

MondayClient(<key>).items.create_item(
            board_id=<board_id>,
            group_id=<group_id>,
            item_name='"A" name,
            column_values={"key": '"A" value'},
)

However, the "s are not escaped and will therefore generate a faulty query:

mutation
    {
        create_item (
            board_id: 1234,
            group_id: "4321",
            item_name: ""A" name",  #<-- this is the problem
            column_values: "{\\"key\\": \\"\\\\\\"A\\\\\\" value\\"}",
            create_labels_if_missing: false
        ) {
            id
        }
    }

I've worked around this for now by doing a value.replace('"', '\\"') before passing it to the api, but it would be nice if this library took care of it automatically.

For updating I'm only using change_multiple_column_values where the item name is in the dictionary, so no problems there, but there are probably other places where unescaped quotes are an issue.

binairo avatar Oct 28 '21 13:10 binairo