mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 03:36:42 +00:00
fail UFSServe if Webserver is null. (#21467)
This commit is contained in:
parent
a14aad93cb
commit
522f6c5e00
@ -950,34 +950,32 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void UFSServe(void) {
|
void UFSServe(void) {
|
||||||
|
bool result = false;
|
||||||
if (XdrvMailbox.data_len > 0) {
|
if (XdrvMailbox.data_len > 0) {
|
||||||
bool result = false;
|
|
||||||
char *fpath = strtok(XdrvMailbox.data, ",");
|
char *fpath = strtok(XdrvMailbox.data, ",");
|
||||||
char *url = strtok(nullptr, ",");
|
char *url = strtok(nullptr, ",");
|
||||||
char *noauth = strtok(nullptr, ",");
|
char *noauth = strtok(nullptr, ",");
|
||||||
if (fpath && url) {
|
if (fpath && url) {
|
||||||
char t[] = "";
|
if (Webserver) { // fail if no Webserver yet.
|
||||||
StaticRequestHandlerAuth *staticHandler;
|
StaticRequestHandlerAuth *staticHandler;
|
||||||
if (noauth && *noauth == '1'){
|
if (noauth && *noauth == '1'){
|
||||||
staticHandler = (StaticRequestHandlerAuth *) new StaticRequestHandler(*ffsp, fpath, url, (char *)nullptr);
|
staticHandler = (StaticRequestHandlerAuth *) new StaticRequestHandler(*ffsp, fpath, url, (char *)nullptr);
|
||||||
} else {
|
} else {
|
||||||
staticHandler = new StaticRequestHandlerAuth(*ffsp, fpath, url, (char *)nullptr);
|
staticHandler = new StaticRequestHandlerAuth(*ffsp, fpath, url, (char *)nullptr);
|
||||||
}
|
}
|
||||||
if (staticHandler) {
|
if (staticHandler) {
|
||||||
//Webserver->serveStatic(url, *ffsp, fpath);
|
//Webserver->serveStatic(url, *ffsp, fpath);
|
||||||
Webserver->addHandler(staticHandler);
|
Webserver->addHandler(staticHandler);
|
||||||
Webserver->enableCORS(true);
|
Webserver->enableCORS(true);
|
||||||
result = true;
|
result = true;
|
||||||
} else {
|
}
|
||||||
// could this happen? only lack of memory.
|
|
||||||
result = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!result) {
|
}
|
||||||
ResponseCmndFailed();
|
if (!result) {
|
||||||
} else {
|
ResponseCmndFailed();
|
||||||
ResponseCmndDone();
|
} else {
|
||||||
}
|
ResponseCmndDone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // UFILESYS_STATIC_SERVING
|
#endif // UFILESYS_STATIC_SERVING
|
||||||
|
Loading…
x
Reference in New Issue
Block a user