Fix for #92 vfs::zip unable to read zip archives with wrong modes master
authorWojciech Kocjan <zoro2@users.sourceforge.net>
Mon, 10 Mar 2014 11:40:46 +0000 (11:40 +0000)
committerWojciech Kocjan <zoro2@users.sourceforge.net>
Mon, 10 Mar 2014 11:40:46 +0000 (11:40 +0000)
library/zipvfs.tcl

index 7cb00a65d7aaa61b37f08f4cc40f67cef5345a79..80900ac20c50caa937d6ce0a6d9ef5cf4b8ec6d8 100644 (file)
@@ -89,6 +89,11 @@ proc vfs::zip::stat {zipfd name} {
     if {($sb(mode) & 0xf000) == 0x2000} {
         set sb(mode) [expr {$sb(mode) ^ 0x2000}]
     }
+    # workaround for certain errorneus zip archives
+    if {($sb(mode) & 0xffff) == 0xffff} {
+       # change to directory type and set mode to 0777 + directory flag
+       set sb(mode) 0x41ff
+    }
     array get sb
 }