CenterForOpenScience / waterbutler

WaterButler is a Python web application for interacting with various file storage services via a single RESTful API, developed at Center for Open Science.
Apache License 2.0
62 stars 76 forks source link

[No Ticket] Fix The Issue that Branch Name with Slash Breaks BB Repo Endpoints #377

Closed cslzchen closed 5 years ago

cslzchen commented 5 years ago

Ticket

No Ticket

Purpose

The BB API 2.0 path endpoint /2.0/repositories/{username}/{repo_slug}/src/{node}/{path} WB uses returns HTTP 404 if the {node} segment is a branch of which the name contains a slash. This is either a limitation or a bug on several BB API 2.0 endpoints, which has nothing to do with encoding. More specifically, neither encoding / with %2F nor enclosing node with curly braces (%7B and %7D) works.

Here is the closest reference to this issue we have found as of May 2019 and here is another one without further discussion or solution.

Note: this is an issue with BB API 2.0 only and was introduced to staging servers by https://github.com/CenterForOpenScience/waterbutler/pull/375 (ENG-303).

This PR fixes the above issue by making an extra request to fetch the commit SHA of the branch.

Changes

The BB Provider

BB Unit Tests

Side effects

An extra request is made, which is unavoidable. However, this performance overhead is alright.

QA Notes

Local Tests I Have Verified

Deployment Notes

Not I can think of yet.

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.03%) to 91.823% when pulling 80f4a10e535a858ca53c72a512318fc6f23ef1d5 on cslzchen:fix/bb-api-branch-name-with-slash into e708170c272665b3e6208ec02fe5310a10778734 on CenterForOpenScience:develop.