rgalanakis/hostthedocs

Decouple the Project Name from the Project URL (add a "url_name" parameter)

Opened this issue · 2 comments

There should be a "url_name" parameter or something like that.

When uploading docs where name has a space in it, you end up getting urls that have %20:

curl -X POST -F filedata=@archive.zip -F name="Some Name" -F version="0.0.1" -F description="Some Description" http://my_htd_instance/hmfd
# --> http://my_htd_instance/static/docfiles/Some%20Name/0.0.1/index.html

Personally I find this a bit ugly.

If there were another parameter that we could optionally send, we could do nifty things like this:

curl -X POST -F filedata=@archive.zip -F url_name="my_project" -F name="Some Name" -F version="0.0.1" -F description="Some Description" http://my_htd_instance/hmfd
# --> http://my_htd_instance/static/docfiles/my_project/0.0.1/index.html

This would allow users to decouple the project name, what's seen here:
image
from the project url.

If the url_name parameter is not given, it just defaults to the name parameter, thus not changing the current functionality

Though personally I'd like to see name get URL-ized by going all lowercase and replacing space with underscore or dash, but that's a bit more breaking than what I'm proposing here.

That's a cool idea, would you want to submit a PR for it?

It's on my list of things to look into, but I doubt I'll be able to get around to it any time soon 😢