overwrite files in storage partition, cron log file switche off

This commit is contained in:
Bogdan Pilyugin 2023-12-07 13:30:19 +02:00
parent f2448d6dc3
commit 9fbb16a5db
3 changed files with 16 additions and 9 deletions

View File

@ -30,7 +30,7 @@
#define REAST_API_DEBUG_MODE 0
#define EXPECTED_MAX_DATA_SIZE (4096 + 2048)
#define EXPECTED_MAX_DATA_SIZE (4096 * 2)
#define VAR_MAX_NAME_LENGTH (32)
#define VAR_MAX_VALUE_LENGTH (EXPECTED_MAX_DATA_SIZE - 512)

View File

@ -108,7 +108,7 @@ void TimeObtainHandler(struct timeval *tm)
ReloadCronSheduler();
ExecuteLastAction(GetSystemObjects());
ExecuteLastAction(GetCustomObjects());
LogFile("cron.log", "Cron service started");
}
void DebugTimer()

View File

@ -329,13 +329,7 @@ esp_err_t upload_post_handler(httpd_req_t *req)
return ESP_FAIL;
}
if (stat(filepath, &file_stat) == 0)
{
ESP_LOGE(TAG, "File already exists : %s", filepath);
/* Respond with 400 Bad Request */
httpd_resp_send_err(req, HTTPD_400_BAD_REQUEST, "File already exists");
return ESP_FAIL;
}
/* File cannot be larger than a limit */
if (req->content_len > MAX_FILE_SIZE)
@ -350,6 +344,19 @@ esp_err_t upload_post_handler(httpd_req_t *req)
return ESP_FAIL;
}
if (stat(filepath, &file_stat) == 0)
{
ESP_LOGW(TAG, "File already exists : %s", filepath);
/* Respond with 400 Bad Request */
//httpd_resp_send_err(req, HTTPD_400_BAD_REQUEST, "File already exists");
//return ESP_FAIL;
unlink(filepath);
}
fd = fopen(filepath, "w");
if (!fd)
{