Skip to content

Bitbucket - get_content_of_file() does not handle filename with spaces in it. #1485

Closed
@san-gitlogin

Description

@san-gitlogin

For example, if the file path passed as an argument to the "get_content_of_file()" is - "something/child/ABCD123R #7 --- for Some testing.txt", the stack trace is as follows:

File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/atlassian/bitbucket/__init__.py", line 2625, in get_content_of_file return self.get(url, params=params, not_json_response=True, headers=headers) │ │ │ │ └ {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'X-Atlassian-Token': 'no-check'} │ │ │ └ {} │ │ └ 'rest/api/1.0/projects/EPFILE/repos/iar_kit/raw/something/child/ABCD123R #07 --- for Some testing.txt' │ └ <function AtlassianRestAPI.get at 0x102742340> └ <atlassian.bitbucket.Bitbucket object at 0x102a597f0> File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/atlassian/rest_client.py", line 341, in get response = self.request( │ └ <function AtlassianRestAPI.request at 0x1027422a0> └ <atlassian.bitbucket.Bitbucket object at 0x102a597f0> File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/atlassian/rest_client.py", line 313, in request self.raise_for_status(response) │ │ └ <Response [404]> │ └ <function AtlassianRestAPI.raise_for_status at 0x102742700> └ <atlassian.bitbucket.Bitbucket object at 0x102a597f0> File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/atlassian/rest_client.py", line 580, in raise_for_status raise HTTPError(error_msg, response=response) │ │ └ <Response [404]> │ └ 'The path "something/child/ABCD123R " does not exist at revision "refs/heads/master"' └ <class 'requests.exceptions.HTTPError'>

Notice the path is taken incorrectly as "something/child/ABCD123R " excluding the data after the space, instead of considering the complete path "something/child/ABCD123R #7 --- for Some testing.txt"

I cross-checked that the file does exist in the provided path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions