Skip to content

Commit

Permalink
Expand from root rather than current working directory
Browse files Browse the repository at this point in the history
  • Loading branch information
jdleesmiller committed Aug 26, 2018
1 parent 3dd165b commit 8a1de58
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/zip/entry.rb
Expand Up @@ -115,8 +115,9 @@ def name_is_directory? #:nodoc:all
def name_safe?
cleanpath = Pathname.new(@name).cleanpath
return false unless cleanpath.relative?
naive_expanded_path = ::File.join(Dir.pwd, cleanpath.to_s)
cleanpath.expand_path.to_s == naive_expanded_path
root = ::File::SEPARATOR
naive_expanded_path = ::File.join(root, cleanpath.to_s)
cleanpath.expand_path(root).to_s == naive_expanded_path
end

def local_entry_offset #:nodoc:all
Expand Down

0 comments on commit 8a1de58

Please sign in to comment.