pythonanywhere / help_pages

The help pages for help.pythonanywhere.com
43 stars 86 forks source link

Fixed missing slash in API file endpoint path #60

Closed camrail closed 1 year ago

camrail commented 4 years ago

Hi there, this is my first commit for a project which is not my own so hope this is correct - just missing a forward slash in the file endpoint path.

gpjt commented 4 years ago

Thanks for the suggestion! Pull requests are always welcome, and thanks for sending us this one.

However, this one is debatable and has been suggested before. The docs are technically correct (the best kind of correct!) because a Unix path starts with a slash. If our documentation said /api/v0/user/{username}/files/path/{path} then the URL for the path /home/someusername/something.txt would be /api/v0/user/someusername/files/path//home/someusername/something.txt (note the double slash), which would be wrong.

As people keep suggesting this change, I'm thinking that perhaps the best solution is to see if we can put something in the docs to explain the above -- perhaps just underneath where it says

/api/v0/user/{username}/files/path{path}

...we could say "please note that the lack of a slash between the path and the {path} is not a typo -- Unix paths start with a slash, so the endpoint for a file called /home/someusername/somefile.txt would be /api/v0/user/someusername/files/path/home/someusername/somefile.txt.

What do you think?

camrail commented 4 years ago

Ah yes that makes sense but definitely looked like a typo for the less informed. I think that clarification is a good suggestion given the context.