Downloading a file using the src API might lead to a different filesize

XMLWordPrintable

    • 2
    • Severity 3 - Minor
    • 591

      Issue Summary

      When we download a file using this API: https://api.bitbucket.org/2.0/repositories/<workspace>/<repo_slug>/src/<commit>/<path>, this endpoint returns the raw contents. The response's Content-Type is derived from the filename extension (not from the contents). The file contents are not processed and no character encoding/recoding is performed, and as a result, no character encoding is included as part of the Content-Type. This leads to a different filesize than the actual filesize.

      Steps to Reproduce

      1. Use the API endpoint https://api.bitbucket.org/2.0/repositories/<workspace>/<repo_slug>/src/<commit>/<path> to download a file.
      2. Observe the Content-Type and filesize of the downloaded file.

      Expected Results

      The Content-Type should include character encoding, and the filesize should match the actual filesize of the file.

      Actual Results

      The Content-Type is derived from the filename extension without character encoding, leading to a different filesize than the actual filesize.

      Workaround

      Cloning the repository instead of fetching it using the API.

            Assignee:
            Unassigned
            Reporter:
            Norbert Csupka (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: