Skip to content

Commit

Permalink
Merge pull request #20 from Backelite/feature/fix_zip_warnings
Browse files Browse the repository at this point in the history
Fix warnings on invalid date raised by RubyZip
  • Loading branch information
devunwired committed Apr 18, 2017
2 parents 6110f98 + 0a459b2 commit ba4d6d5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions apktools.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

Gem::Specification.new do |s|
s.name = 'apktools'
s.version = '0.7.1'
s.date = '2016-02-22'
s.version = '0.7.2'
s.date = '2017-04-03'
s.summary = 'APKTools'
s.description = 'Library to assist reading resource data out of Android APKs'
s.authors = ['Dave Smith']
Expand All @@ -30,5 +30,5 @@ Gem::Specification.new do |s|

s.executables << 'get_app_version.rb'
s.executables << 'read_manifest.rb'
s.add_runtime_dependency 'rubyzip', '~> 1.1'
s.add_runtime_dependency 'rubyzip', '~> 1.2.1'
end
3 changes: 2 additions & 1 deletion lib/apktools/apkresources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,10 @@ class ApkResources
# Create a new ApkResources instance from the specified +apk_file+
#
# This opens and parses the contents of the APK's resources.arsc file.

def initialize(apk_file)
data = nil
Zip.warn_invalid_date = false

# Get resources.arsc from the APK file
Zip::File.foreach(apk_file) do |f|
if f.name.match(/resources.arsc/)
Expand Down
6 changes: 4 additions & 2 deletions lib/apktools/apkxml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class ApkXml
# This opens and parses the contents of the APK's resources.arsc file.
def initialize(apk_file)
@current_apk = apk_file
Zip.warn_invalid_date = false
@apk_resources = ApkResources.new(apk_file)
end #initialize

Expand All @@ -129,17 +130,18 @@ def initialize(apk_file)
def parse_xml(xml_file, pretty = false, resolve_resources = false)
# Reset variables
@xml_elements = Array.new()
xml_output = ""
xml_output = ''
indent = 0
data = nil

# Get the XML from the APK file
Zip.warn_invalid_date = false
Zip::File.foreach(@current_apk) do |f|
if f.name.match(xml_file)
data = f.get_input_stream.read.force_encoding('BINARY')
end
end


# Parse the Header Chunk
header = ChunkHeader.new( read_short(data, HEADER_START),
read_short(data, HEADER_START+2),
Expand Down

0 comments on commit ba4d6d5

Please sign in to comment.