-
-
Notifications
You must be signed in to change notification settings - Fork 293
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
List directory if the index file doesn't exist #484
Conversation
Good stuff! Please do look into that test failure though and see whether perhaps you actually need to change or make new tests to make sure the new behavior is also being covered. |
ce9827e
to
a3be4f9
Compare
a3be4f9
to
8489521
Compare
This makes me wonder: Should we warn in case the file provided by For instance, it's possible to serve /a while providing In fact, now that I think about it, perhaps we should default to serving the directory the index file is in if no explicit serving path is provided. What do you think? |
I don't see the point of allowing the user to set a full path for
I believe index option may need a check of something like: |
@aliemjay I'm very much interested in merging this. See also this effort in actix-web to offer something similar upstream. However, I'd like to get the path questions that I asked cleaned up and tested. As you said, it probably doesn't make much sense to allow the user to set a path outside the index file path or at worst it's a bad surprise for the user! How about we change the behavior of the program like this:
Does that make sense to you? This way, we'd establish more intuitive behavior for |
The PR mentioned conflicts with the behaviour implemented here! |
I agree, we don't necessarily follow upstream. Let's roll with your adapted implementation instead. How do you want to resolve the path problems laid out above? |
I've just gave it a thought and had some problems:
|
Hmm I think in that case it would indeed be the best next thing to just serve each directory's respective index file if that exists and fall back to listing the files otherwise. The compromise would be that |
If you mean the current behaviour, then I think it's totally fine and intuitive :) In this case, --index option needs a check to accept only a single file name. |
actix-files doesn't support such behaviour, which makes it necessary to implement in the "listing renderer".
and when path is explicitly specified, make sure that index option is a single file name, not a full path.
Rebased and tried to fix the path issue with the following behaviour:
Plus, if the serving path is explicitely provided, then |
Can you rebase this for the new amazing tests? :) |
Superseded by #583. |
actix-files doesn't support such behaviour, which makes it necessary to
implement in the "listing renderer".
Should fix #275