Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zip::CompressionMethodError (Unsupported compression method 9) #337

Closed
aakanksha0402 opened this issue Aug 21, 2017 · 2 comments
Closed

Comments

@aakanksha0402
Copy link

aakanksha0402 commented Aug 21, 2017

Hello,

I'm working with Rails 5.0.1 and rubyzip 1.2.1. I'm working on a project where the user will be uploading large zip files and i'm using paperclip for uploading. After the files are uploaded to the server, they are being unzipped and saved.

Note: The error occurred for file created in windows using the default "Right click -> Send -> Compressed Folder". Also, the uploaded file is very large.

Following is my code for unzipping the files:

path = "path is generated dynamically"
 zip_path = "path of the zip"

 FileUtils.mkdir_p(path)

 Zip::File.open(zip_path) do |zip_file|
   zip_file.each do |f|
     fpath = File.join(destination, f.name.gsub(" ","_")) #Replacing the spaces with hyphens
     zip_file.extract(f, fpath) unless File.exist?(fpath)
   end
 end

So far i know this is related to the Deflate64 algorithm used by windows but that's it.

I have referred the following links:

  1. unsupported compression method: 9 balena-io/etcher#1499
  2. unsupported compression method: 9 thejoshwolfe/yauzl#58
  3. Zip::ZipCompressionMethodError: Unsupported compression method 98 #35
  4. https://stackoverflow.com/questions/19441879/truezip-returning-unsupported-compression-method-error-when-extracting-large-fil
  5. zip files don't unzip with standard os x archiver - (error 1 - operation not permitted) #249

though, i'm yet unsure of the solution here. Is there a workaround to unzip this file?

Please guide me as to what can be done here. Thanks.

@pujas13
Copy link

pujas13 commented Feb 22, 2019

Did you get any answers for this?

@hainesr
Copy link
Member

hainesr commented May 29, 2021

Sorry to come back to this after so long - maybe this answer will still be of some use.

The issue with Deflate64 is that it is a proprietary/closed format owned by PKWare and, as far as I know, there is no ruby implementation. If there is one that you know of please let me know, or you could implement it as an extension for rubyzip, like the bzip2 one: https://github.com/rubyzip/rubyzip-bzip2

@hainesr hainesr closed this as completed May 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants