chore: condense the if statement

This commit is contained in:
ahadcove 2022-10-24 11:34:56 -04:00
parent 21de073784
commit 92329a8dd0

View File

@ -45,14 +45,14 @@ void handleUpload(AsyncWebServerRequest *request, const String& filename, size_t
request->_tempFile = WLED_FS.open(finalname, "w"); request->_tempFile = WLED_FS.open(finalname, "w");
DEBUG_PRINT("Uploading "); DEBUG_PRINT("Uploading ");
DEBUG_PRINTLN(finalname); DEBUG_PRINTLN(finalname);
if (finalname == "/presets.json") presetsModifiedTime = toki.second(); if (finalname.indexOf("presets.json") >= 0) presetsModifiedTime = toki.second();
} }
if (len) { if (len) {
request->_tempFile.write(data,len); request->_tempFile.write(data,len);
} }
if (final) { if (final) {
request->_tempFile.close(); request->_tempFile.close();
if (filename == "/cfg.json" || filename == "cfg.json") { if (filename.indexOf("cfg.json") >= 0) {
doReboot = true; doReboot = true;
request->send(200, "text/plain", F("Configuration restore successful.\nRebooting...")); request->send(200, "text/plain", F("Configuration restore successful.\nRebooting..."));
} else } else