- for ( $i = 0 ; $i < @Backups ; $i++ ) {
- if ( !$Backups[$i]{noFill} ) {
- $numF = $Backups[$i]{num};
- $mangleF = $Backups[$i]{mangle};
- $compressF = $Backups[$i]{compress};
- }
- last if ( $Backups[$i]{num} == $num );
- }
- $mangle = $Backups[$i]{mangle};
- $compress = $Backups[$i]{compress};
- if ( !$Backups[$i]{noFill} ) {
- # no need to back-fill a filled backup
- $numF = $mangleF = $compressF = undef;
- }
- my $fullPath = "$TopDir/pc/$host/$num/$dir";
- $fullPath =~ s{/+}{/}g;
- if ( !-f $fullPath && defined($numF) ) {
- my $dirF = $dir;
- my $fullPathF;
- if ( $mangle && !$mangleF ) {
- $fullPathF = "$TopDir/pc/$host/$numF/"
- . $bpc->fileNameUnmangle($dir);
- } else {
- $fullPathF = "$TopDir/pc/$host/$numF/$dir";
- }
- if ( -f $fullPathF ) {
- $fullPath = $fullPathF;
- $compress = $compressF;
- }
- }
- if ( $fullPath =~ m{(^|/)\.\.(/|$)} || !-f $fullPath ) {
- ErrorExit(eval("qq{$Lang->{Can_t_restore_bad_file}}"));
+ my @Backups = $bpc->BackupInfoRead($host);
+ my $view = BackupPC::View->new($bpc, $host, \@Backups);
+ my $a = $view->fileAttrib($num, $share, $dir);
+ if ( $dir =~ m{(^|/)\.\.(/|$)} || !defined($a) ) {
+ ErrorExit("Can't restore bad file ${EscHTML($dir)}");