add check if filesystem error

This commit is contained in:
Luc 2019-08-16 21:59:49 +02:00
parent cecd0a9de0
commit 2933e406fb

View File

@ -190,8 +190,14 @@ void HTTP_Server::handleFSFileList ()
}
}
buffer2send += "],\"path\":\"" + path + "\",";
buffer2send += "\"status\":\"" + status + "\",";
if (ESP_FileSystem::totalBytes()>0) {
buffer2send += "\"occupation\":\"" + String(100*ESP_FileSystem::usedBytes()/ESP_FileSystem::totalBytes()) + "\",";
} else {
status = "FileSystem Error";
buffer2send += "\"occupation\":\"0\",";
}
buffer2send += "\"status\":\"" + status + "\",";
buffer2send += "\"total\":\"" + ESP_FileSystem::formatBytes (ESP_FileSystem::totalBytes()) + "\",";
buffer2send += "\"used\":\"" + ESP_FileSystem::formatBytes (ESP_FileSystem::usedBytes()) + "\"}";
path = "";