@@ -13,11 +13,14 @@ pub mod path_splitting {
13
13
pub enum PathSplitError {
14
14
/// entry path format error: {0:?}
15
15
PathFormat ( String ) ,
16
- /// file and directory paths overlapped : {0:?}
17
- FileDirOverlap ( String ) ,
16
+ /// duplicate path used for file and directory: {0:?}
17
+ DuplicateFileDirPath ( String ) ,
18
18
}
19
19
20
20
fn split_by_separator ( entry_path : & str ) -> Result < impl Iterator < Item = & str > , PathSplitError > {
21
+ /* FIXME: The ZIP spec states (APPNOTE 4.4.17) that file paths are in Unix format, and Unix
22
+ * filesystems treat a backslash as a normal character. Thus they should be allowed on Unix
23
+ * and replaced with \u{fffd} on Windows. */
21
24
if entry_path. contains ( '\\' ) {
22
25
if entry_path. contains ( '/' ) {
23
26
return Err ( PathSplitError :: PathFormat ( format ! (
@@ -151,7 +154,7 @@ pub mod path_splitting {
151
154
. or_insert_with ( || Box :: new ( FSEntry :: Dir ( DirEntry :: default ( ) ) ) ) ;
152
155
cur_dir = match next_subdir. as_mut ( ) {
153
156
FSEntry :: File ( _) => {
154
- return Err ( PathSplitError :: FileDirOverlap ( format ! (
157
+ return Err ( PathSplitError :: DuplicateFileDirPath ( format ! (
155
158
"a file was already registered at the same path as the dir entry {:?}" ,
156
159
entry_path
157
160
) ) ) ;
@@ -164,7 +167,7 @@ pub mod path_splitting {
164
167
/* We can't handle duplicate file paths, as that might mess up our
165
168
* parallelization strategy. */
166
169
if cur_dir. children . contains_key ( filename) {
167
- return Err ( PathSplitError :: FileDirOverlap ( format ! (
170
+ return Err ( PathSplitError :: DuplicateFileDirPath ( format ! (
168
171
"another file or directory was already registered at the same path as the file entry {:?}" ,
169
172
entry_path
170
173
) ) ) ;
@@ -178,7 +181,7 @@ pub mod path_splitting {
178
181
* path, as it's not clear how to merge the possibility of two separate file
179
182
* permissions. */
180
183
if cur_dir. properties . replace ( data) . is_some ( ) {
181
- return Err ( PathSplitError :: FileDirOverlap ( format ! (
184
+ return Err ( PathSplitError :: DuplicateFileDirPath ( format ! (
182
185
"another directory was already registered at the path {:?}" ,
183
186
entry_path
184
187
) ) ) ;
@@ -191,7 +194,7 @@ pub mod path_splitting {
191
194
properties,
192
195
children,
193
196
} = base_dir;
194
- assert ! ( properties. is_none( ) , "setting metadata on the top-level extraction dir is not allowed and should have been filtered out" ) ;
197
+ debug_assert ! ( properties. is_none( ) , "setting metadata on the top-level extraction dir is not allowed and should have been filtered out" ) ;
195
198
Ok ( children)
196
199
}
197
200
@@ -491,6 +494,8 @@ pub mod handle_creation {
491
494
properties,
492
495
children,
493
496
} ) => {
497
+ /* FIXME: use something like make_writable_dir_all() and then add to
498
+ * perms_todo! */
494
499
match fs:: create_dir ( & path) {
495
500
Err ( e) if e. kind ( ) == io:: ErrorKind :: AlreadyExists => ( ) ,
496
501
Err ( e) => return Err ( e. into ( ) ) ,
0 commit comments