Skip to content

Commit

Permalink
Upgrade rubyzip to fix the ArgumentError
Browse files Browse the repository at this point in the history
  • Loading branch information
mcls committed Apr 25, 2015
1 parent 1cc0bcc commit 7814f0a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Expand Up @@ -301,7 +301,7 @@ GEM
sexp_processor (~> 4.0)
ruby_parser (3.5.0)
sexp_processor (~> 4.1)
rubyzip (1.1.6)
rubyzip (1.1.7)
safe_yaml (1.0.4)
sass (3.2.19)
sass-rails (4.0.3)
Expand Down
16 changes: 1 addition & 15 deletions app/models/project/download.rb
Expand Up @@ -18,7 +18,7 @@ def call
http_client.get_content(project.download_zip_url) { |chunk|
zip_file.write(chunk)
}
rescue_reopen_error { unzip_to_source_files(zip_file) }
unzip_to_source_files(zip_file)
end
end

Expand All @@ -28,20 +28,6 @@ def filename
"#{project.username}-#{project.name}"
end

# Catch and ignore weird `reopen` error message from rubyzip gem
def rescue_reopen_error
begin
return yield
rescue ArgumentError => e
line = e.backtrace.first
if line =~ /reopen/ && e.message =~ /wrong number of arguments \(0 for 1\.\.2\)/
logger.warn { "While unzipping, ignoring exception: #{e.inspect}" }
else
raise e
end
end
end

# @param file [String]
def unzip_to_source_files(file)
zipfile = Project::ZipFile.new(file, project: project)
Expand Down

0 comments on commit 7814f0a

Please sign in to comment.