]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Only use deflate when size is not set if the user did not specify a compression algorithm
authorjiat75 <jiat0218@gmail.com>
Sat, 16 Oct 2021 07:33:25 +0000 (15:33 +0800)
committerjiat75 <jiat0218@gmail.com>
Tue, 19 Oct 2021 14:28:34 +0000 (22:28 +0800)
libarchive/archive_write_set_format_zip.c

index f4352d5a9f78f93da50a068555f752dc276f73ea..ea60054ce368ef536cf12fe871b1dab708926428 100644 (file)
@@ -745,7 +745,13 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry)
                 * makes length-at-end more reliable) and will
                 * enable Zip64 extensions unless we're told not to.
                 */
-               zip->entry_compression = COMPRESSION_DEFAULT;
+
+               #ifdef HAVE_ZLIB_H
+               if(zip->requested_compression == COMPRESSION_UNSPECIFIED){
+                       zip->entry_compression = COMPRESSION_DEFLATE;
+               }
+               #endif
+
                zip->entry_flags |= ZIP_ENTRY_FLAG_LENGTH_AT_END;
                if ((zip->flags & ZIP_FLAG_AVOID_ZIP64) == 0) {
                        zip->entry_uses_zip64 = 1;