Properly handle filenames starting with -

This commit is contained in:
Jamie Cameron
2026-10-10 15:18:44 -07:00
parent 42850e5795
commit 1e1f9982d7
3 changed files with 7 additions and 8 deletions

View File

@@ -42,7 +42,7 @@ elsif ($in{'method'} eq 'zip') {
$extension = ".zip";
$full = &validate_filename_path($in{'arch'}.$extension);
$command = "cd ".quotemeta($cwd).
" && zip -r ".quotemeta($full);
" && zip -r -- ".quotemeta($full);
}
else {
&error("Unknown method!");

View File

@@ -31,9 +31,9 @@ elsif ($archive_type =~ /x-7z/ ||
elsif ($archive_type =~ /\/zip/) {
my $unzip_out = `unzip --help`;
my $uu = ($unzip_out =~ /-UU/ ? '-UU' : undef);
$cmd = "unzip $uu -q -o ".
quotemeta($full).
" -d ".quotemeta($cwd);
$cmd = "unzip $uu -q -o".
" -d ".quotemeta($cwd).
" -- ".quotemeta($full);
}
elsif ($archive_type =~ /\/x-rar|\/vnd\.rar/) {
$cmd = "unrar x -r -y ".

View File

@@ -1110,10 +1110,9 @@ foreach my $fref (@{$files_to_extract}) {
my $uu = ($unzip_out =~ /-UU/
? '-UU' : undef);
$status = system(
"$unzip_cmd $uu -q -o " .
quotemeta($archive) .
" -d " .
quotemeta($extract_to));
"$unzip_cmd $uu -q -o".
" -d " .quotemeta($extract_to).
" -- ".quotemeta($archive));
}
}
elsif ($archive_type =~ /\/x-rar|\/vnd\.rar/) {