Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-22267

File content with special characters or URL encoded value in its name cannot be retrieved via API

XMLWordPrintable

      Issue Summary

      File content with special characters like # or URL encoded values like %26 in its name cannot be retrieved via API

      Steps to Reproduce

      1. In a Bitbucket Cloud repo, create and commit a file with a URL encoded value or special character in its name, e.g. "test %26 file.txt" or "test # file.txt"
      2. If the file was created and committed locally, push it to Bitbucket remote repository 
      3. Get the file's content with the following API endpoint:

      https://developer.atlassian.com/cloud/bitbucket/rest/api-group-source/#api-repositories-workspace-repo-slug-src-commit-path-get

      Example call for the file name"test %26 file.txt" :

      curl --request GET "https://api.bitbucket.org/2.0/repositories/<workspace-id>/<repo-slug>/src/<commit-hash>/test%20%2526%20file.txt" --header 'Accept: application/json' --user '<username>:<app-password>'
      

      Expected Results

      The API call returns the content of the file.

      Actual Results

      The API call returns the following error:

      {"type":"error","error":{"message":"No such file or directory: test & file.txt"}}
      

      Workaround

      Currently, there is no known workaround for this behavior. A workaround will be added here when available

              dfraser@atlassian.com Dan Fraser
              tboudale Theodora Boudale (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: