mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-05 14:10:41 +08:00
Add sanity check in rmdir
Fix typo in mkdir web command
This commit is contained in:
parent
7cf4b881fd
commit
deda296a10
@ -22,7 +22,7 @@
|
||||
#define _VERSION_ESP3D_H
|
||||
|
||||
//version and sources location
|
||||
#define FW_VERSION "3.0.0.a53"
|
||||
#define FW_VERSION "3.0.0.a54"
|
||||
#define REPOSITORY "https://github.com/luc-github/ESP3D/tree/3.0"
|
||||
|
||||
#endif //_VERSION_ESP3D_H
|
||||
|
@ -199,7 +199,11 @@ bool ESP_SD::remove(const char *path)
|
||||
|
||||
bool ESP_SD::mkdir(const char *path)
|
||||
{
|
||||
return SD_MMC.mkdir(path);
|
||||
String p = path;
|
||||
if (p.endsWith("/")) {
|
||||
p.remove( p.length() - 1,1);
|
||||
}
|
||||
return SD_MMC.mkdir(p.c_str());
|
||||
}
|
||||
|
||||
bool ESP_SD::rmdir(const char *path)
|
||||
@ -210,6 +214,9 @@ bool ESP_SD::rmdir(const char *path)
|
||||
bool res = true;
|
||||
GenLinkedList<String > pathlist;
|
||||
String p = path;
|
||||
if (p.endsWith("/")) {
|
||||
p.remove( p.length() - 1,1);
|
||||
}
|
||||
pathlist.push(p);
|
||||
while (pathlist.count() > 0) {
|
||||
File dir = SD_MMC.open(pathlist.getLast().c_str());
|
||||
|
@ -116,7 +116,7 @@ void HTTP_Server::handleSDFileList ()
|
||||
//create a directory
|
||||
if (_webserver->arg ("action") == "createdir" && _webserver->hasArg ("filename") ) {
|
||||
String filename;
|
||||
filename = path + _webserver->arg ("filename") + "/.";
|
||||
filename = path + _webserver->arg ("filename");
|
||||
String shortname = _webserver->arg ("filename");
|
||||
shortname.replace ("/", "");
|
||||
filename.replace ("//", "/");
|
||||
|
Loading…
x
Reference in New Issue
Block a user