Skip to content

Update spiffs_api.cpp #1819

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
wants to merge 1 commit into from
Closed

Update spiffs_api.cpp #1819

wants to merge 1 commit into from

Conversation

seclorum
Copy link

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

Fixes a bug where un-prefixed files are irretrievable with openDir(""). Described: esp8266#1818.
@igrr
Copy link
Member

igrr commented Mar 26, 2016

You may need to update the test as well. Old behaviour (openDir("") should return empty list) was checked here: https://github.com/esp8266/Arduino/blob/master/tests/host/fs/test_fs.cpp#L163-L164

@hallard
Copy link
Contributor

hallard commented Mar 29, 2016

Just my 2 cents, why not change the original isSpiffsFilenameValid where is the problem, checking len >0 by adding *name == 0 in the 1st if, like this ?

bool isSpiffsFilenameValid(const char* name)
{
    if (name == nullptr || *name == 0) {
        return false;
    }
    auto len = strlen(name);
    return len > 0 && len < SPIFFS_OBJ_NAME_LEN;
}

original is currently

bool isSpiffsFilenameValid(const char* name)
{
    if (name == nullptr) {
        return false;
    }
    auto len = strlen(name);
    return len > 0 && len < SPIFFS_OBJ_NAME_LEN;
}```

@ghost
Copy link

ghost commented Apr 11, 2016

Can one of the admins verify this patch?

@igrr igrr mentioned this pull request Jun 13, 2016
@igrr
Copy link
Member

igrr commented Jun 13, 2016

Reopened as #2143, with test cases fixed.

@igrr igrr closed this Jun 13, 2016
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.

3 participants