Archive download and special characters

I see that an archive of a commit can be HTTP GET at http://<server>/<repo>/archive/<commit_id>.zip.
With a Mercurial repo, I see that we can use the name of a branch or tag instead of the commit_id.

This is great!

Now my problem is that our convention is to prefix the names of our feature branches with f/, like in f/my-feature. Obviously if I want to use this branch name in the url, I have to escape the slash in some way. Is there any way to do it?

I tried to escape it using %2F (http://<server>/<repo>/archive/ but it does not work:

  • With the Apache config AllowEncodedSlashes set to Off, it gives an Apache 404
  • With AllowEncodedSlashes set to On, it gives a RhodeCode 404
  • With AllowEncodedSlashes set to NoDecode, it gives the text “Unknown commit_id f%2Fmy-feature”

Hmm, actually i think this might be a bug.

if you would see that matching pattern:

This wouldn’t catch f/feature-1 name for example. I think we need to change it to:

        pattern='/{repo_name:.*?[^/]}/archive/{fname:.*}', repo_route=True)

Like in other places that match a path or names with /

When I apply this change, there is indeed one Apache configuration that makes it work: AllowEncodedSlashes On. The other values behave the same as before.

Quick follow up: from the source code it seems that we should be able to download a .zip, a .tgz or a .tbz2. Only the .zip works for me, is there a configuration to enable the other two?


Other formats are available with the following extensions:

1 Like