From: Christian Garbs Date: Tue, 17 Nov 2015 23:20:22 +0000 (+0100) Subject: fix quoting in AsyncWgetFileGetter again X-Git-Url: https://git.camperquake.de/gitweb.cgi?p=videosite.git;a=commitdiff_plain;h=HEAD fix quoting in AsyncWgetFileGetter again make youtube file https://www.youtube.com/watch?v=DDfRPtDsedA work - ' was not quoted correctly: '\\'' does not work in shell, it has to be '"'"' --- diff --git a/videosite/AsyncWgetFileGetter.pm b/videosite/AsyncWgetFileGetter.pm index 0cc6856..756b416 100644 --- a/videosite/AsyncWgetFileGetter.pm +++ b/videosite/AsyncWgetFileGetter.pm @@ -66,14 +66,14 @@ sub _download { my $cookie = ''; my $useragent = qq{ --user-agent='Mozilla/4.0 (compatible; MSIE 5.0; Linux) Opera 5.0 [en]' }; - $dlfile =~ s/([\\'])/\\$1/g; # ??? - + $dlfile =~ s/'/'"'"'/g; # escape ' as '"'"' (end current 'string', new "string" containing a ', start new 'string') + my (undef, $tmpfile) = tempfile('videosite.tmp.XXXXXXXXXXXX', DIR => dirname($dlfile)); $self->debug('Going to download %s to %s (%s)', $dlurl, $dlfile, $tmpfile); $cookie = qq{ --header='Cookie: $video->{'COOKIE'}'} if (defined $video->{'COOKIE'}); - my $cmdline = qq{ ( wget -q -O'$tmpfile' $useragent $cookie '$video->{'DLURL'}' && mv '$tmpfile' '$dlfile' && chmod =rw '$dlfile' && touch '$dlfile' || rm -f '$tmpfile' ) & }; + my $cmdline = qq{ ( wget -q -O'$tmpfile' $useragent $cookie '$dlurl' && mv '$tmpfile' '$dlfile' && chmod =rw '$dlfile' && touch '$dlfile' || rm -f '$tmpfile' ) & }; $self->debug("Going to execute: %s", $cmdline); system($cmdline);