| 525 | } |
| 526 | |
| 527 | esp_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 | |
| 544 | esp_err_t otaHandler(httpd_req_t *req) { |
| 545 | if (!checkUserWebAuth(req)) return ESP_OK; |
nothing calls this directly
no test coverage detected