Skip Menu |

This queue is for tickets about the MediaWiki-API CPAN distribution.

Report information
The Basics
Id: 78197
Status: resolved
Priority: 0/
Queue: MediaWiki-API

People
Owner: Nobody in particular
Requestors: Matthieu.Moy [...] imag.fr
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.39
Fixed in: (no value)



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;
Show quoted text
> 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.
Your patch is included in the 0.40 release which should appear on cpan shortly. Apologies for the 2 year delay - I got seriously sidetracked with other projects. Many thanks for the fix.