Subject: | download() method broken for HTTPS wikis |
When using the download() method on a wiki accessed with HTTPS, API.pm
checks for relative URLs with "$url =~ /^http\:\/\//" and if not, does
the concatenation
$url = $self->{config}->{files_url} . $url;
which results in funny URLs like :
https://example.com/path/tohttps://example.com/path/to/file.ext
A trivial fix is to turn "http" into "https?" (one-liner patch
attached). Perhaps there's a more clever way to look for relative URLs
using e.g. the URI module.
Subject: | download-fix.patch |
--- API.pm~ 2012-05-20 03:06:33.000000000 +0200
+++ API.pm 2012-07-04 13:21:02.000000000 +0200
@@ -795,7 +795,7 @@
my $url = @{ $pageref->{imageinfo} }[0]->{url};
- unless ( $url =~ /^http\:\/\// ) {
+ unless ( $url =~ /^https?\:\/\// ) {
return $self->_error(ERR_PARAMS,'The API returned a relative path. You need to configure the url where files are stored in {config}->{files_url}')
unless ( defined $self->{config}->{files_url} );
$url = $self->{config}->{files_url} . $url;