-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#921 show directory index (from PR #1033) #1094
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If we want to access a static file dir, it should return `Forbidden (403)` by default. Related: aio-libs#921
XXX: need for a response to return proper html Related: aio-libs#921
Also I now return in place, instead of creating variable and returning later, I am not a fan of returning somewehere inside a method, though if we tried to return `ret` at the end as before, but I guess it's the most clean pattern to do this. This is because we have to conditional blocks, either of which can return from the method. If first condtitonal creates `ret` variable, later conditional may just raise `HTTPNotFound` which we do not want. Though, I do not want to check that `ret` is populated either. Thus return in place. Related: aio-libs#921
- Better method name - More human readable output (newlines) - Title is shown as relative path to static directory and not as posix path - Show directories with slash at the end of the name
And fix a minor typo
…quested folder Related: aio-libs#921
Related: aio-libs#921
Current coverage is 97.78% (diff: 100%)
|
Could you please cover missing three lines? |
Related: aio-libs#921
Related: aio-libs#921
@asvetlov done! Pls check. |
Thanks! |
This was referenced Aug 22, 2016
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What do these changes do?
HTTP 403 - Forbidden
if we access static directoryHTTP 403 - Forbidden
Are there changes in behavior for the user?
UrlDispatcher.add_static
got new flag -show_index
, which will show index of a directory if explicitly set toTrue
. By default, accessing directory index is forbidden (HTTP/403,show_index=False
)Related issue number
#921
Checklist
Points taken from PR #1033:
StaticRoute._directory_as_html()
:(This is not necessary as discussed with @asvetlov)