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.
A bit of a follow-up to #6987. The subject matters is once again LittleFS support for
ESP8266WebServer.serveStatic()
and the cause of problematic behavior is once again that you can create aFile
for a directory in LittleFS, but can't in SPIFFS.When the path was a directory, but didn't have a slash at the end, a 0 byte response would be sent if using LittleFS. This pull request fixes this weird behavior and now it will return a 404 instead.
<aside>
The reason for returning a 404 is that this is the behavior you get when using SPIFFS. However, that's probably because it's quite hard to detect that situation on SPIFFS. On LittleFS, it's simple (we're basically already doing it with this change), so there is a case to be made to return a 301 to
path + "/"
(as is the default behavior of both apache and nginx). It means different behavior between SPIFFS and LittleFS, but the best behavior that can be supported for both.If you guys agree that this is the way to go, I might actually pick this up.
</aside>