Skip to content

Commit

Permalink
Merge 529634e into 1777a3f
Browse files Browse the repository at this point in the history
  • Loading branch information
hainesr committed Jun 2, 2021
2 parents 1777a3f + 529634e commit 8bbdce9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Lint/MissingSuper:
# Offense count: 5
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 601
Max: 610

# Offense count: 20
# Configuration parameters: IgnoredMethods.
Expand Down
8 changes: 5 additions & 3 deletions lib/zip/entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,12 @@ def read_local_entry(io) #:nodoc:all
set_time(@last_mod_date, @last_mod_time)

@name = io.read(@name_length)
extra = io.read(@extra_length)

@name.tr!('\\', '/')
if ::Zip.force_entry_names_encoding
@name.force_encoding(::Zip.force_entry_names_encoding)
end
@name.tr!('\\', '/') # Normalise filepath separators after encoding set.

extra = io.read(@extra_length)
if extra && extra.bytesize != @extra_length
raise ::Zip::Error, 'Truncated local zip entry header'
end
Expand Down Expand Up @@ -424,10 +423,13 @@ def read_c_dir_entry(io) #:nodoc:all
unpack_c_dir_entry(static_sized_fields_buf)
check_c_dir_entry_signature
set_time(@last_mod_date, @last_mod_time)

@name = io.read(@name_length)
if ::Zip.force_entry_names_encoding
@name.force_encoding(::Zip.force_entry_names_encoding)
end
@name.tr!('\\', '/') # Normalise filepath separators after encoding set.

read_extra_field(io.read(@extra_length))
@comment = io.read(@comment_length)
check_c_dir_entry_comment_size
Expand Down

0 comments on commit 8bbdce9

Please sign in to comment.