@@ -232,9 +232,9 @@ pub fn split_zip(p_bytes: &[u8]) -> (&[u8], Option<&[u8]>) {
232
232
continue ;
233
233
}
234
234
235
- let zip_path = & p_bytes[ 0 ..next_char_idx + 1 ] ;
235
+ let zip_path = & p_bytes[ 0 ..next_char_idx] ;
236
236
let sub_path = p_bytes. get ( next_char_idx + 1 ..) ;
237
-
237
+
238
238
return ( zip_path, sub_path) ;
239
239
} else {
240
240
break ;
@@ -300,7 +300,7 @@ pub fn vpath(p: &Path) -> std::io::Result<VPath> {
300
300
return Err ( std:: io:: Error :: new ( std:: io:: ErrorKind :: Other , "Invalid virtual back-reference" ) )
301
301
}
302
302
303
- base_path_u8 = & archive_path_u8[ 0 ..base_path_len] ;
303
+ base_path_u8 = & archive_path_u8[ 0 ..base_path_len - 1 ] ;
304
304
305
305
virtual_segments = Some ( (
306
306
io_bytes_to_str ( & archive_path_u8[ base_path_len..archive_path_u8. len ( ) ] ) ?. to_string ( ) ,
@@ -370,52 +370,52 @@ mod tests {
370
370
["foo", null],
371
371
["foo.zip", null],
372
372
["foo.zip/bar", {
373
- "basePath": "foo.zip/ ",
373
+ "basePath": "foo.zip",
374
374
"virtualSegments": null,
375
375
"zipPath": "bar"
376
376
}],
377
377
["foo.zip/bar/baz", {
378
- "basePath": "foo.zip/ ",
378
+ "basePath": "foo.zip",
379
379
"virtualSegments": null,
380
380
"zipPath": "bar/baz"
381
381
}],
382
382
["/a/b/c/foo.zip", null],
383
383
["./a/b/c/foo.zip", null],
384
384
["./a/b/__virtual__/abcdef/0/c/d", {
385
- "basePath": "a/b/ ",
385
+ "basePath": "a/b",
386
386
"virtualSegments": ["__virtual__/abcdef/0/c/d", "c/d"],
387
387
"zipPath": null
388
388
}],
389
389
["./a/b/__virtual__/abcdef/1/c/d", {
390
- "basePath": "a/ ",
390
+ "basePath": "a",
391
391
"virtualSegments": ["b/__virtual__/abcdef/1/c/d", "c/d"],
392
392
"zipPath": null
393
393
}],
394
394
["./a/b/__virtual__/abcdef/0/c/foo.zip/bar", {
395
- "basePath": "a/b/ ",
396
- "virtualSegments": ["__virtual__/abcdef/0/c/foo.zip/ ", "c/foo.zip/ "],
395
+ "basePath": "a/b",
396
+ "virtualSegments": ["__virtual__/abcdef/0/c/foo.zip", "c/foo.zip"],
397
397
"zipPath": "bar"
398
398
}],
399
399
["./a/b/__virtual__/abcdef/1/c/foo.zip/bar", {
400
- "basePath": "a/ ",
401
- "virtualSegments": ["b/__virtual__/abcdef/1/c/foo.zip/ ", "c/foo.zip/ "],
400
+ "basePath": "a",
401
+ "virtualSegments": ["b/__virtual__/abcdef/1/c/foo.zip", "c/foo.zip"],
402
402
"zipPath": "bar"
403
403
}],
404
404
["./a/b/c/.zip", null],
405
405
["./a/b/c/foo.zipp", null],
406
406
["./a/b/c/foo.zip/bar/baz/qux.zip", {
407
- "basePath": "a/b/c/foo.zip/ ",
407
+ "basePath": "a/b/c/foo.zip",
408
408
"virtualSegments": null,
409
409
"zipPath": "bar/baz/qux.zip"
410
410
}],
411
411
["./a/b/c/foo.zip-bar.zip", null],
412
412
["./a/b/c/foo.zip-bar.zip/bar/baz/qux.zip", {
413
- "basePath": "a/b/c/foo.zip-bar.zip/ ",
413
+ "basePath": "a/b/c/foo.zip-bar.zip",
414
414
"virtualSegments": null,
415
415
"zipPath": "bar/baz/qux.zip"
416
416
}],
417
417
["./a/b/c/foo.zip-bar/foo.zip-bar/foo.zip-bar.zip/d", {
418
- "basePath": "a/b/c/foo.zip-bar/foo.zip-bar/foo.zip-bar.zip/ ",
418
+ "basePath": "a/b/c/foo.zip-bar/foo.zip-bar/foo.zip-bar.zip",
419
419
"virtualSegments": null,
420
420
"zipPath": "d"
421
421
}]
0 commit comments