diff --git a/cores/esp8266/spiffs_api.cpp b/cores/esp8266/spiffs_api.cpp index 5420174a94..f1c94791d4 100644 --- a/cores/esp8266/spiffs_api.cpp +++ b/cores/esp8266/spiffs_api.cpp @@ -63,12 +63,14 @@ bool SPIFFSImpl::exists(const char* path) return rc == SPIFFS_OK; } -DirImplPtr SPIFFSImpl::openDir(const char* path) -{ - if (!isSpiffsFilenameValid(path)) { - DEBUGV("SPIFFSImpl::openDir: invalid path=`%s` \r\n", path); - return DirImplPtr(); +DirImplPtr SPIFFSImpl::openDir(const char* path) { + if (strlen(path) > 0) { + if (!isSpiffsFilenameValid(path)) { + DEBUGV("SPIFFSImpl::openDir: invalid path=`%s` \r\n", path); + return DirImplPtr(); + } } + spiffs_DIR dir; spiffs_DIR* result = SPIFFS_opendir(&_fs, path, &dir); if (!result) {