Skip to content

Commit d16a71a

Browse files
committed
Update spiffs_api.cpp
Fixes a bug where un-prefixed files are irretrievable with openDir(""). Described: esp8266#1818.
1 parent 633e48f commit d16a71a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

cores/esp8266/spiffs_api.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,14 @@ bool SPIFFSImpl::exists(const char* path)
6363
return rc == SPIFFS_OK;
6464
}
6565

66-
DirImplPtr SPIFFSImpl::openDir(const char* path)
67-
{
68-
if (!isSpiffsFilenameValid(path)) {
69-
DEBUGV("SPIFFSImpl::openDir: invalid path=`%s` \r\n", path);
70-
return DirImplPtr();
66+
DirImplPtr SPIFFSImpl::openDir(const char* path) {
67+
if (strlen(path) > 0) {
68+
if (!isSpiffsFilenameValid(path)) {
69+
DEBUGV("SPIFFSImpl::openDir: invalid path=`%s` \r\n", path);
70+
return DirImplPtr();
71+
}
7172
}
73+
7274
spiffs_DIR dir;
7375
spiffs_DIR* result = SPIFFS_opendir(&_fs, path, &dir);
7476
if (!result) {

0 commit comments

Comments
 (0)