util::zip_file_contains_valid_filenames (private)

 util::zip_file_contains_valid_filenames zip_fn

Defined in packages/acs-tcl/tcl/utilities-procs.tcl

Check, if the provided zip file contains only filenames with valid UTF-8 characters. Unfortunately, handling different character sets differs between variants of unzip (also between unzip between the redhat and debian families). For details about file structure of zip files, consult e.g. https://en.wikipedia.org/wiki/ZIP_(file_format)

Parameters:
zip_fn
Returns:
boolean

Partial Call Graph (max 5 caller/called nodes):
%3 util::unzip util::unzip (public) util::zip_file_contains_valid_filenames util::zip_file_contains_valid_filenames util::unzip->util::zip_file_contains_valid_filenames

Testcases:
No testcase defined.
Source code:
       set F [open $zip_fn rb]; set C [read $F]; close $F
       set validUTF8 1
       while {$validUTF8 && [binary encode hex [string range $C 0 3]] eq "504b0304"} {
           binary scan [string range $C 26 27] s fnSize
           binary scan [string range $C 28 29] s extraFieldSize
           set validUTF8 [ns_valid_utf8 [string range $C 30 29+$fnSize]]
           set C [string range $C [expr {30 + $fnSize + $extraFieldSize}] end]
       }
       return $validUTF8
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-tcl/tcl/utilities-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: