Implement `Zip::FileSystem::ZipFsFile#symlink?`

This commit is contained in:
Finn Bacall 2022-06-13 16:47:51 +01:00 committed by Robert Haines
parent ffa90a37cb
commit 8b87b0e200
2 changed files with 5 additions and 3 deletions

View File

@ -197,8 +197,8 @@ module Zip
false
end
def symlink?(_filename)
false
def symlink?(filename)
@mapped_zip.get_entry(filename).symlink?
end
def socket?(_filename)

View File

@ -186,7 +186,9 @@ class FileNonmutatingTest < MiniTest::Test
end
def test_symlink?
assert_always_false(:symlink?)
zip_file = ::Zip::File.new('test/data/path_traversal/tuzovakaoff/symlink.zip')
assert(zip_file.file.symlink?('path'))
assert(!zip_file.file.symlink?('path/file.txt'))
end
def test_socket?