diff --git a/include/SystemApplication.h b/include/SystemApplication.h index b30bda4..b49293c 100644 --- a/include/SystemApplication.h +++ b/include/SystemApplication.h @@ -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) diff --git a/src/CronTimers.c b/src/CronTimers.c index 714c63e..2c1511b 100644 --- a/src/CronTimers.c +++ b/src/CronTimers.c @@ -108,7 +108,7 @@ void TimeObtainHandler(struct timeval *tm) ReloadCronSheduler(); ExecuteLastAction(GetSystemObjects()); ExecuteLastAction(GetCustomObjects()); - LogFile("cron.log", "Cron service started"); + } void DebugTimer() diff --git a/src/FileServer.c b/src/FileServer.c index 0fa2214..3f1918b 100644 --- a/src/FileServer.c +++ b/src/FileServer.c @@ -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) {