Skip to content
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

Improve LittleFS support #7071

Merged
merged 4 commits into from
Feb 23, 2020
Merged

Improve LittleFS support #7071

merged 4 commits into from
Feb 23, 2020

Conversation

JasperHorn
Copy link
Contributor

@JasperHorn JasperHorn commented Feb 10, 2020

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 a File 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>

JasperHorn and others added 3 commits February 10, 2020 02:29
Previously, when the path was a directory, but didn't have a slash at
the end, a 0 byte response would be sent when using LittleFS. Now, it
will return a 404, like was always the case when using SPIFFS.
Copy link
Collaborator

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.. Thanks.

@d-a-v d-a-v merged commit d990ff9 into esp8266:master Feb 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants