]> granicus.if.org Git - pgbadger/commitdiff
fix SSH URIs for files, directories and wildcards
authortbussmann <t.bussmann@gmx.net>
Fri, 12 Jul 2019 14:39:57 +0000 (16:39 +0200)
committertbussmann <t.bussmann@gmx.net>
Fri, 12 Jul 2019 14:39:57 +0000 (16:39 +0200)
835231a / PR #500 did break again the use of wildcards in SSH URI filenames that 0a45659 / #477 took care of. This patch should finally offer a solution that can deal with absolute and relative paths, spaces in paths, wildcards in filenames, single files and whole directories.

pgbadger

index f88c5a5fa6bc20df2248ddaf63297a137f6fa578..4acf7ce21607d3bed8cfd0538f994b0a57f7e877 100755 (executable)
--- a/pgbadger
+++ b/pgbadger
@@ -2219,7 +2219,7 @@ sub set_file_list
                                my($filename, $dirs, $suffix) = fileparse($file);
                                &logmsg('DEBUG', "Looking for remote filename using command: $ssh $host_info \"ls '$dirs'$filename\"");
                                my @rfiles = `$ssh $host_info "ls '$dirs'$filename"`;
-        $dirs = '' if ( @rfiles <= 1 );
+                               $dirs = '' if ( $filename ne '' ); #ls returns relative paths for an directory but absolute ones for a file or filename pattern 
                                foreach my $f (@rfiles)
                                {
                                        push(@lfiles, "ssh://$host_info/$dirs$f$fmt");