@@ -454,11 +454,25 @@ void archive_reader::run(fs_writer &writer) {
454
454
archive_entry *pe;
455
455
while (check_archive (pa.get (), archive_read_next_header (pa.get (), &pe))) {
456
456
print_progress ((double )archive_filter_bytes (pa.get (), -1 ) / as);
457
- auto p = from_utf8 (archive_entry_pathname (pe));
457
+ wstr p;
458
+ auto up = archive_entry_pathname (pe);
459
+ if (up) p = from_utf8 (up);
460
+ else {
461
+ auto wp = archive_entry_pathname_w (pe);
462
+ if (wp) p = wp;
463
+ else throw error_other (err_convert_encoding, {});
464
+ }
458
465
if (!normalize_linux_path (p, rp)) continue ;
466
+ wstr tp;
467
+ bool hl = true ;
459
468
auto utp = archive_entry_hardlink (pe);
460
- if (utp) {
461
- auto tp = from_utf8 (utp);
469
+ if (utp) tp = from_utf8 (utp);
470
+ else {
471
+ auto wtp = archive_entry_hardlink_w (pe);
472
+ if (wtp) tp = wtp;
473
+ else hl = false ;
474
+ }
475
+ if (hl) {
462
476
if (normalize_linux_path (tp, rp)) {
463
477
writer.write_hard_link (p, tp);
464
478
}
@@ -491,6 +505,11 @@ void archive_reader::run(fs_writer &writer) {
491
505
writer.write_file_data (nullptr , 0 );
492
506
} else if (type == AE_IFLNK) {
493
507
auto tp = archive_entry_symlink (pe);
508
+ std::unique_ptr<char []> ptp = nullptr ;
509
+ if (!tp) {
510
+ ptp = to_utf8 (archive_entry_symlink_w (pe));
511
+ tp = ptp.get ();
512
+ }
494
513
writer.write_symlink (p, attr, tp);
495
514
} else { // AE_IFDIR
496
515
writer.write_directory (p, attr);
0 commit comments