mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-03 11:22:38 +02:00
Infer / at beginning of SD path name
The LocalFS path processing code already inserts a / at the beginning of the path is one isn't present. This patch does the same for SD files.
This commit is contained in:
@@ -666,11 +666,14 @@ namespace WebUI {
|
|||||||
|
|
||||||
#ifdef ENABLE_SD_CARD
|
#ifdef ENABLE_SD_CARD
|
||||||
static Error openSDFile(char* parameter) {
|
static Error openSDFile(char* parameter) {
|
||||||
parameter = trim(parameter);
|
|
||||||
if (*parameter == '\0') {
|
if (*parameter == '\0') {
|
||||||
webPrintln("Missing file name!");
|
webPrintln("Missing file name!");
|
||||||
return Error::InvalidValue;
|
return Error::InvalidValue;
|
||||||
}
|
}
|
||||||
|
String path = trim(parameter);
|
||||||
|
if (path[0] != '/') {
|
||||||
|
path = "/" + path;
|
||||||
|
}
|
||||||
int8_t state = get_sd_state(true);
|
int8_t state = get_sd_state(true);
|
||||||
if (state != SDCARD_IDLE) {
|
if (state != SDCARD_IDLE) {
|
||||||
if (state == SDCARD_NOT_PRESENT) {
|
if (state == SDCARD_NOT_PRESENT) {
|
||||||
@@ -685,7 +688,7 @@ namespace WebUI {
|
|||||||
webPrintln("Busy");
|
webPrintln("Busy");
|
||||||
return Error::IdleError;
|
return Error::IdleError;
|
||||||
}
|
}
|
||||||
if (!openFile(SD, parameter)) {
|
if (!openFile(SD, path.c_str())) {
|
||||||
report_status_message(Error::SdFailedRead, (espresponse) ? espresponse->client() : CLIENT_ALL);
|
report_status_message(Error::SdFailedRead, (espresponse) ? espresponse->client() : CLIENT_ALL);
|
||||||
webPrintln("");
|
webPrintln("");
|
||||||
return Error::SdFailedOpenFile;
|
return Error::SdFailedOpenFile;
|
||||||
|
Reference in New Issue
Block a user