mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
ensure user isn't removing invalid path
This commit is contained in:
parent
a22c176d45
commit
9d574b2de0
1 changed files with 13 additions and 6 deletions
|
|
@ -1358,12 +1358,19 @@ void MyMesh::checkCLIRescueCmd() {
|
||||||
// get path from command e.g: "rm /adv_blobs"
|
// get path from command e.g: "rm /adv_blobs"
|
||||||
const char *path = &cli_command[4];
|
const char *path = &cli_command[4];
|
||||||
|
|
||||||
// remove file
|
// ensure path is not empty, or root dir
|
||||||
bool removed = _store->removeFile(path);
|
if(!path || strlen(path) == 0 || strcmp(path, "/") == 0){
|
||||||
if(removed){
|
Serial.println("Invalid path provided");
|
||||||
Serial.println("File removed");
|
|
||||||
} else {
|
} else {
|
||||||
Serial.println("Failed to remove file");
|
|
||||||
|
// remove file
|
||||||
|
bool removed = _store->removeFile(path);
|
||||||
|
if(removed){
|
||||||
|
Serial.println("File removed");
|
||||||
|
} else {
|
||||||
|
Serial.println("Failed to remove file");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (strcmp(cli_command, "reboot") == 0) {
|
} else if (strcmp(cli_command, "reboot") == 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue