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

Add LittleFS support to ESP8266WebServer.serveStatic() #6987

Merged
merged 3 commits into from
Jan 5, 2020

Conversation

JasperHorn
Copy link
Contributor

The problem was that the library was assuming that FS::exists() would return false for directories, which is true for SPIFFS, but not for LittleFS. I changed the implementation to be compatible with both.

I don't like using fs.open(), but I couldn't find any better way to check if something is a directory or a file. If there is such a thing, please point me in the right direction and I will be happy to use that instead.

The previous implementation was based on a quirk of SPIFFS (that exists
returns false for directories) so it wouldn't work with LittleFS. This
implementation works with both.
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.

Thanks, looks OK. There is a way using the openDir to find if a file is a dir or a file, but this method isn't iterating over a dir, it's responding to a single request.

@earlephilhower earlephilhower merged commit 8242d72 into esp8266:master Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants