mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 12:36:52 +03:00
fix extracting directories
This commit is contained in:
@@ -489,7 +489,7 @@ static esp_err_t upload_post_handler(httpd_req_t *req)
|
|||||||
|
|
||||||
while (remaining > 0) {
|
while (remaining > 0) {
|
||||||
|
|
||||||
//ESP_LOGI(TAG_FILESERVER, "Remaining size : %d", remaining);
|
ESP_LOGI(TAG_FILESERVER, "Remaining size : %d", remaining);
|
||||||
/* Receive the file part by part into a buffer */
|
/* Receive the file part by part into a buffer */
|
||||||
if ((received = httpd_req_recv(req, buf, MIN(remaining, SCRATCH_BUFSIZE))) <= 0) {
|
if ((received = httpd_req_recv(req, buf, MIN(remaining, SCRATCH_BUFSIZE))) <= 0) {
|
||||||
if (received == HTTPD_SOCK_ERR_TIMEOUT) {
|
if (received == HTTPD_SOCK_ERR_TIMEOUT) {
|
||||||
@@ -753,6 +753,7 @@ std::string unzip_new(std::string _in_zip_file, std::string _target_zip, std::st
|
|||||||
mz_zip_reader_file_stat(&zip_archive, i, &file_stat);
|
mz_zip_reader_file_stat(&zip_archive, i, &file_stat);
|
||||||
sprintf(archive_filename, file_stat.m_filename);
|
sprintf(archive_filename, file_stat.m_filename);
|
||||||
|
|
||||||
|
if (!file_stat.m_is_directory) {
|
||||||
// Try to extract all the files to the heap.
|
// Try to extract all the files to the heap.
|
||||||
p = mz_zip_reader_extract_file_to_heap(&zip_archive, archive_filename, &uncomp_size, 0);
|
p = mz_zip_reader_extract_file_to_heap(&zip_archive, archive_filename, &uncomp_size, 0);
|
||||||
if (!p)
|
if (!p)
|
||||||
@@ -804,6 +805,7 @@ std::string unzip_new(std::string _in_zip_file, std::string _target_zip, std::st
|
|||||||
// We're done.
|
// We're done.
|
||||||
mz_free(p);
|
mz_free(p);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Close the archive, freeing any resources it was using
|
// Close the archive, freeing any resources it was using
|
||||||
mz_zip_reader_end(&zip_archive);
|
mz_zip_reader_end(&zip_archive);
|
||||||
|
|||||||
Reference in New Issue
Block a user