fix extracting directories

This commit is contained in:
Frank Haverland
2022-09-25 17:56:04 +02:00
parent 265616ff80
commit b1b76feeb0

View File

@@ -489,7 +489,7 @@ static esp_err_t upload_post_handler(httpd_req_t *req)
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 */
if ((received = httpd_req_recv(req, buf, MIN(remaining, SCRATCH_BUFSIZE))) <= 0) {
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);
sprintf(archive_filename, file_stat.m_filename);
if (!file_stat.m_is_directory) {
// Try to extract all the files to the heap.
p = mz_zip_reader_extract_file_to_heap(&zip_archive, archive_filename, &uncomp_size, 0);
if (!p)
@@ -804,6 +805,7 @@ std::string unzip_new(std::string _in_zip_file, std::string _target_zip, std::st
// We're done.
mz_free(p);
}
}
// Close the archive, freeing any resources it was using
mz_zip_reader_end(&zip_archive);