MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / renameHandler

Function renameHandler

src/webInterface.cpp:527–542  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

525}
526
527esp_err_t renameHandler(httpd_req_t *req) {
528 if (!checkUserWebAuth(req)) return ESP_OK;
529 WebParamMap params = readParams(req);
530 if (!params.has("fileName") || !params.has("filePath")) {
531 sendText(req, 400, "text/plain", "Missing fileName or filePath");
532 return ESP_OK;
533 }
534 String fileName = params.get("fileName");
535 String filePath = params.get("filePath");
536 String filePath2 = filePath.substring(0, filePath.lastIndexOf('/') + 1) + fileName;
537 if (!setupSdCard()) sendText(req, "text/plain", "Fail starting SD Card.");
538 else if (SDM.rename(filePath, filePath2))
539 sendText(req, "text/plain", filePath + " renamed to " + filePath2);
540 else sendText(req, "text/plain", "Fail renaming file.");
541 return ESP_OK;
542}
543
544esp_err_t otaHandler(httpd_req_t *req) {
545 if (!checkUserWebAuth(req)) return ESP_OK;

Callers

nothing calls this directly

Calls 5

checkUserWebAuthFunction · 0.85
readParamsFunction · 0.85
sendTextFunction · 0.85
hasMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected