pythonanywhere / help_pages

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

Add missing / in the "Files" routes #48

Closed J-GG closed 5 years ago

gpjt commented 5 years ago

Hmm, that's an interesting one. Technically speaking, the current docs are correct, and the proposed change is incorrect -- but I can certainly see why it's confusing.

The API endpoint is currently described as

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

So, if you want to download the file /home/username/foo.py, then the URL should be:

/api/v0/user/username/files/path/home/username/foo.py

With the proposed change, it would imply that the URL should be

/api/v0/user/username/files/path//home/username/foo.py

...which is incorrect.

But yeah, it does look confusing as it is and I can imagine that someone not realising that all valid Unix absolute paths begin with a "/" would miss out the slash and get it wrong in the other direction.

Still not sure what the correct solution is, though.

conradho commented 5 years ago

hmm, on the other hand if someone accessed /api/v0/user/username/files/path//home/username/foo.py with the double slash, that would actually still work, even though that is "incorrect" and wasn't our intention. So I am inclined to accept the pull request. any thoughts?