Package: uscan Severity: wishlist Tags: patch If a HREF contains HTML entities (most commonly "&") or no filename can be extracted with basename(), uscan fails to download the file.
I suggest to add a new option "localfilename" which can override $newfile_base. The patch I've attached, adds this option, so something like this is possible: # # HREF=http://foo.bar.org/download/?path=&download=foo-0.1.1.tar.gz # version=4 opts=localfilename=s/.*=(.*)/$1/ \ http://foo.bar.org/download/ \?path=&download=foo-(.*).tar.gz The localfilename-option behaves just like uversionmangle and dversionmangle. It may be possible, that the HREF does not contain a filename at all. In this case, something like this can be done: # # HREF=http://foo.bar.org/download/?path=&download_version=0.1.1 # version=4 opts=localfilename=s/.*/download.tar.gz/ \ http://foo.bar.org/download/ \?path=&download_version=(.*) This will always save the download as download.tar.gz. In both of the above examples, "&" has to be replaced by "&" before starting the download (see attached patch). -- System Information: Debian Release: testing/unstable APT prefers testing APT policy: (500, 'testing') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.11-1-k7 Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)
--- uscan 2005-08-04 04:15:22.000000000 +0200 +++ uscan-neu 2005-09-09 23:24:41.000000000 +0200 @@ -43,7 +43,7 @@ } } } -my $CURRENT_WATCHFILE_VERSION = 3; +my $CURRENT_WATCHFILE_VERSION = 4; my $progname = basename($0); my $modified_conf_msg; @@ -627,6 +627,9 @@ elsif ($opt =~ /^dversionmangle\s*=\s*(.+)/) { @{$options{'dversionmangle'}} = split /;/, $1; } + elsif ($opt =~ /^localfilename\s*=\s*(.+)/) { + @{$options{'localfilename'}} = split /;/, $1; + } else { warn "$progname warning: unrecognised option $opt\n"; } @@ -807,6 +810,13 @@ } my $newfile_base=basename($newfile); + if (exists $options{'localfilename'}) + { + $newfile_base=$newfile; + } + foreach my $pat (@{$options{'localfilename'}}) { + eval "\$newfile_base =~ $pat;"; + } # Remove HTTP header trash if ($site =~ m%^http://%) { @@ -921,6 +931,11 @@ # Download newer package if ($upstream_url =~ m%^http://%) { print STDERR "$progname debug: requesting URL $upstream_url\n" if $debug; + + # substitute HTML entities + # TODO: anything else than "&" required? + $upstream_url =~ s/&/&/; + $request = HTTP::Request->new('GET', $upstream_url); $response = $user_agent->request($request, "../$newfile_base"); if (! $response->is_success) {
signature.asc
Description: OpenPGP digital signature