Here is my case:
The input is a URL “Shows a file” (from https://github.com/gitbucket/gitbucket/wiki/List-of-URL-Formats).
I want to distinguish the actual file path part from a branch name. So, ‘master’ from ‘STL%20files/Electronics%20box/Box.STL’ in this case.
The problem is that branch name can have slashes in it. Example:
In this case, branch name is ‘custom/branch’ and path is
The resulting path/branch is going to be used in an API call:
Where ‘:path’ just a file path only, and branch name is provided via ‘ref’ parameter.
The way we do it right now is by iteratively removing parts from everything after ‘blob/’ (in the incoming URL) waiting for non-404 response. This feels wasteful. If someone has a branch name with many slashes - we will make many useless calls.
Is there a way?