Add Danbooru::Archive library for handling .zip and .rar files.

Introduce a new Danbooru::Archive library. This is a wrapper around libarchive that lets us extract
.zip, .rar, .7z, and other archive formats. Replace the rubyzip library in MediaFile::Ugoira with
the new Danbooru::Archive library.

This is a step towards fixing #5340: Add support for extracting archive attachments from certain sources.

This adds a new dependency on libarchive. Downstream users should `apt-get install libarchive13` if
they're not using Docker.

https://github.com/chef/ffi-libarchive
https://github.com/libarchive/libarchive
https://www.rubydoc.info/gems/ffi-libarchive/0.4.2
https://github.com/libarchive/libarchive/wiki/Examples#a-complete-extractor
This commit is contained in:
evazion
2022-11-14 13:36:09 -06:00
parent f942768ce8
commit 0c1e9a1618
6 changed files with 361 additions and 27 deletions

View File

@@ -187,6 +187,8 @@ GEM
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
ffi-libarchive (1.1.3)
ffi (~> 1.0)
flamegraph (0.9.5)
fugit (1.7.1)
et-orbi (~> 1, >= 1.2.7)
@@ -550,6 +552,7 @@ DEPENDENCIES
factory_bot
ffaker
ffi
ffi-libarchive
flamegraph
good_job
google-cloud-bigquery
@@ -589,7 +592,6 @@ DEPENDENCIES
rubocop
rubocop-rails
ruby-vips
rubyzip
sanitize
scenic
selenium-webdriver