From 0f75145a5fb608ab3215c1ccf071a851dc6a7378 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sun, 22 Jan 2023 15:41:38 +0200 Subject: [PATCH] file storage web access URL changed from "file" to "storage" --- src/FileServer.c | 8 ++++---- src/HTTPServer.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/FileServer.c b/src/FileServer.c index 74daa88..0fa2214 100644 --- a/src/FileServer.c +++ b/src/FileServer.c @@ -103,7 +103,7 @@ static const char* get_path_from_uri(char *dest, const char *base_path, /* Construct full path (base + path) */ strcpy(dest, base_path); - strlcpy(dest + base_pathlen, uri + (sizeof("/files")-1), pathlen + 1 - (sizeof("/files")-1)); + strlcpy(dest + base_pathlen, uri + (sizeof("/storage")-1), pathlen + 1 - (sizeof("/storage")-1)); /* Return pointer to path, skipping the base */ return dest + base_pathlen; @@ -184,7 +184,7 @@ static esp_err_t http_resp_dir_html(httpd_req_t *req, const char *dirpath) httpd_resp_sendstr_chunk(req, ""); httpd_resp_sendstr_chunk(req, entrysize); httpd_resp_sendstr_chunk(req, ""); - httpd_resp_sendstr_chunk(req, "
uri); httpd_resp_sendstr_chunk(req, entry->d_name); httpd_resp_sendstr_chunk(req, "\">
"); @@ -418,7 +418,7 @@ esp_err_t upload_post_handler(httpd_req_t *req) /* Redirect onto root to see the updated file list */ httpd_resp_set_status(req, "303 See Other"); - httpd_resp_set_hdr(req, "Location", "/files/"); + httpd_resp_set_hdr(req, "Location", "/storage/"); #ifdef CONFIG_EXAMPLE_HTTPD_CONN_CLOSE_HEADER httpd_resp_set_hdr(req, "Connection", "close"); #endif @@ -466,7 +466,7 @@ esp_err_t delete_post_handler(httpd_req_t *req) /* Redirect onto root to see the updated file list */ httpd_resp_set_status(req, "303 See Other"); - httpd_resp_set_hdr(req, "Location", "/files/"); + httpd_resp_set_hdr(req, "Location", "/storage/"); #ifdef CONFIG_EXAMPLE_HTTPD_CONN_CLOSE_HEADER httpd_resp_set_hdr(req, "Connection", "close"); #endif diff --git a/src/HTTPServer.c b/src/HTTPServer.c index 7ac9ad5..aaf8c8b 100644 --- a/src/HTTPServer.c +++ b/src/HTTPServer.c @@ -173,10 +173,10 @@ static esp_err_t POSTHandler(httpd_req_t *req) ESP_LOGI(TAG, "POST request handle"); #endif - if (memmem(req->uri, strlen(req->uri), "/files/upload/", sizeof("/files/upload/")-1)) + if (memmem(req->uri, strlen(req->uri), "/storage/upload/", sizeof("/storage/upload/")-1)) return upload_post_handler(req); - if (memmem(req->uri, strlen(req->uri), "/files/delete/", sizeof("/files/delete/")-1)) + if (memmem(req->uri, strlen(req->uri), "/storage/delete/", sizeof("/storage/delete/")-1)) return delete_post_handler(req); char *buf = ((struct file_server_data*) req->user_ctx)->scratch; @@ -263,7 +263,7 @@ static esp_err_t GETHandler(httpd_req_t *req) #endif //Route to file server GET handler - if (memmem(req->uri, strlen(req->uri), "/files/", sizeof("/files/") - 1)) + if (memmem(req->uri, strlen(req->uri), "/storage/", sizeof("/storage/") - 1)) return download_get_handler(req); char filepath[FILE_PATH_MAX];