Make warning messages consistent.
And fix a few spelling mistakes.
This commit is contained in:
parent
340379f080
commit
935a4f31a2
|
@ -163,7 +163,7 @@ module Zip
|
||||||
# is passed.
|
# is passed.
|
||||||
def extract(dest_path = nil, &block)
|
def extract(dest_path = nil, &block)
|
||||||
if dest_path.nil? && !name_safe?
|
if dest_path.nil? && !name_safe?
|
||||||
warn "WARNING: skipped #{@name} as unsafe"
|
warn "WARNING: skipped '#{@name}' as unsafe."
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -591,7 +591,7 @@ module Zip
|
||||||
def set_time(binary_dos_date, binary_dos_time)
|
def set_time(binary_dos_date, binary_dos_time)
|
||||||
@time = ::Zip::DOSTime.parse_binary_dos_format(binary_dos_date, binary_dos_time)
|
@time = ::Zip::DOSTime.parse_binary_dos_format(binary_dos_date, binary_dos_time)
|
||||||
rescue ArgumentError
|
rescue ArgumentError
|
||||||
warn 'Invalid date/time in zip entry' if ::Zip.warn_invalid_date
|
warn 'WARNING: invalid date/time in zip entry.' if ::Zip.warn_invalid_date
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_file(dest_path, _continue_on_exists_proc = proc { Zip.continue_on_exists_proc })
|
def create_file(dest_path, _continue_on_exists_proc = proc { Zip.continue_on_exists_proc })
|
||||||
|
@ -610,7 +610,7 @@ module Zip
|
||||||
os << buf
|
os << buf
|
||||||
bytes_written += buf.bytesize
|
bytes_written += buf.bytesize
|
||||||
if bytes_written > size && !warned
|
if bytes_written > size && !warned
|
||||||
message = "Entry #{name} should be #{size}B but is larger when inflated"
|
message = "entry '#{name}' should be #{size}B, but is larger when inflated."
|
||||||
if ::Zip.validate_entry_sizes
|
if ::Zip.validate_entry_sizes
|
||||||
raise ::Zip::EntrySizeError, message
|
raise ::Zip::EntrySizeError, message
|
||||||
else
|
else
|
||||||
|
@ -642,7 +642,7 @@ module Zip
|
||||||
def create_symlink(dest_path)
|
def create_symlink(dest_path)
|
||||||
# TODO: Symlinks pose security challenges. Symlink support temporarily
|
# TODO: Symlinks pose security challenges. Symlink support temporarily
|
||||||
# removed in view of https://github.com/rubyzip/rubyzip/issues/369 .
|
# removed in view of https://github.com/rubyzip/rubyzip/issues/369 .
|
||||||
warn "WARNING: skipped symlink #{dest_path}"
|
warn "WARNING: skipped symlink '#{dest_path}'."
|
||||||
end
|
end
|
||||||
|
|
||||||
# apply missing data from the zip64 extra information field, if present
|
# apply missing data from the zip64 extra information field, if present
|
||||||
|
|
|
@ -16,7 +16,7 @@ module Zip
|
||||||
# If nil, start with empty.
|
# If nil, start with empty.
|
||||||
return false
|
return false
|
||||||
elsif binstr[0, 2] != self.class.const_get(:HEADER_ID)
|
elsif binstr[0, 2] != self.class.const_get(:HEADER_ID)
|
||||||
warn 'Warning: weired extra feild header ID. skip parsing'
|
warn 'WARNING: weird extra field header ID. Skip parsing it.'
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
[binstr[2, 2].unpack('v')[0], binstr[4..-1]]
|
[binstr[2, 2].unpack('v')[0], binstr[4..-1]]
|
||||||
|
|
|
@ -136,7 +136,7 @@ class ZipFileExtractTest < MiniTest::Test
|
||||||
a_entry.extract
|
a_entry.extract
|
||||||
end
|
end
|
||||||
assert_equal \
|
assert_equal \
|
||||||
'Entry a should be 1B but is larger when inflated',
|
"entry 'a' should be 1B, but is larger when inflated.",
|
||||||
error.message
|
error.message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -80,7 +80,7 @@ class ZipSettingsTest < MiniTest::Test
|
||||||
test_file = File.join(File.dirname(__FILE__), 'data', 'WarnInvalidDate.zip')
|
test_file = File.join(File.dirname(__FILE__), 'data', 'WarnInvalidDate.zip')
|
||||||
Zip.warn_invalid_date = true
|
Zip.warn_invalid_date = true
|
||||||
|
|
||||||
assert_output('', /Invalid date\/time in zip entry/) do
|
assert_output('', /invalid date\/time in zip entry/) do
|
||||||
::Zip::File.open(test_file) do |_zf|
|
::Zip::File.open(test_file) do |_zf|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue