Skip to content

Fix to SPIFFS openDir() enumeration .. #1818

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

Closed
seclorum opened this issue Mar 25, 2016 · 0 comments
Closed

Fix to SPIFFS openDir() enumeration .. #1818

seclorum opened this issue Mar 25, 2016 · 0 comments

Comments

@seclorum
Copy link

seclorum commented Mar 25, 2016

There is a bug in SPIFFS.

This simple tweak to SPIFFS:

EDIT: PR here #1819

DirImplPtr SPIFFSImpl::openDir(const char* path) {
    if (strlen(path) > 0) {
        if (!isSpiffsFilenameValid(path)) {
            DEBUGV("SPIFFSImpl::openDir: invalid path=`%s` \r\n", path);
            return DirImplPtr();
        }
    }

.. means that we can do this:

  POVDir = SPIFFS.openDir("");

.. and get the 'root' - i.e. all filenames in the SPIFFS

Note: without this code, there is no way to get files you put into SPIFFS that are not named with the prefix '/', for example .. which is not enforced anywhere else in SPIFFS, so you can in fact put files on SPIFFS that you can't retrieve, at the moment ..

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@seclorum seclorum changed the title Fix to SPIFFS Fix to SPIFFS openDir() enumeration .. Mar 25, 2016
seclorum added a commit to seclorum/Arduino that referenced this issue Mar 25, 2016
Fixes a bug where un-prefixed files are irretrievable with openDir(""). Described: esp8266#1818.
@igrr igrr added this to the 2.2.0 milestone Mar 27, 2016
@igrr igrr modified the milestones: 2.2.0, 2.3.0 Apr 18, 2016
igrr added a commit that referenced this issue Jun 13, 2016
* Update spiffs_api.cpp

Fixes a bug where un-prefixed files are irretrievable with openDir(""). Described: #1818.

* Update FS test cases
@igrr igrr closed this as completed Jun 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants