Skip to content

RequestOptions Filter does not properly escape strings. #418

@1oglop1

Description

@1oglop1

Hi, I tried to find user by user name using request options however I still got errors until I tried to quote_plus the user name string.

Task:

Find user via user name
[email protected]

Steps

import tableauserverclient as tsc
# .. server sign in etc..
request_options = tsc.RequestOptions()
request_options.filter.add(
    tsc.Filter(
        tsc.RequestOptions.Field.Name, 
        tsc.RequestOptions.Operator.Equals, 
        '[email protected]'
        )
)
users, pagination_item = server.users.get(request_options)
print(users)

Expected result

[<User ada95cbc-ca59-4087-bbfe-acbcf55d88a4 [email protected] role=Creator>]

Actual result

[]

This is due to the character + in username.
I'm using quote_plus as a workaround.

import tableauserverclient as tsc
from urllib.parse import quote_plus
# .. server sign in etc..
request_options = tsc.RequestOptions()
request_options.filter.add(
    tsc.Filter(
        tsc.RequestOptions.Field.Name,
        tsc.RequestOptions.Operator.Equals,
        quote_plus('[email protected]')
        )
)
users, pagination_item = server.users.get(request_options)
print(users)
# [<User ada95cbc-ca59-4087-bbfe-acbcf55d88a4 [email protected] role=Creator>]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions