Skip to content

[Bitbucket Cloud] In .each, the q parameter does not support lists #1184

Open
@BraxtonLowers

Description

@BraxtonLowers

When attempting to expand the filter to include multiple pull request states in

repository.pullrequests.each(q=['state="OPEN"','state="DECLINED"', 'state="MERGED"']

the bitbucket REST url forms improperly, treating the inner list value as a string to be urlencoded. On deeper inspection I found that the urlencode function in the request() method of AtlassianRestAPI in atlassian/rest_client.py (imported from urllib.parse) accepts an additional parameter for handling this case called doseq. It defaults to False and is not specified in the AtlassianRestAPI.request call, but if set to True, urlencode handles the inner list (as well as just passing strings) and expected behavior returns.

My only concern with providing a PR is that this is heavily reused functionality, and that urlencode can only differentiate between bytes, string, and sequence objects, so if any other function passes an iterable to the query param argument and expects prior behavior, those use cases may break. Are there automated tests to ensure I don't introduce any regressions? Or is this something that would be manually validated during review of the pull request?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bitbucketAtlassian Bitbucket (Cloud or Server)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions