Author: Brett Wuth <wuth@castrov.cuug.ab.ca>
Last-Update: 2013-07-09
Bug-Debian: https://bugs.debian.org/715419
Description: Fix file: vs image: pages

--- a/lib/WWW/Mediawiki/Client.pm
+++ b/lib/WWW/Mediawiki/Client.pm
@@ -1249,7 +1249,9 @@ sub get_server_page {
     $self->{edit}->{def_minor} = $self->_get_edit_minor_default($doc);
     my $headline = Encode::encode("utf8", $self->_get_page_headline($doc));
     my $expected = lc $pagename;
-    unless (lc($headline) =~ /\Q$expected\E$/) {
+    my $expectedfile = $expected;
+    $expectedfile =~ s/^image:/file:/;
+    unless (lc($headline) =~ /\Q$expected\E$/ or lc($headline) =~ /\Q$expectedfile\E$/) {
         WWW::Mediawiki::Client::ServerPageException->throw(
 	        error => "The server could not resolve the page name
                         '$pagename', but responded that it was '$headline'.",
@@ -1754,7 +1756,10 @@ sub _upload_file {
 
     my $headline = $self->_get_page_headline($doc);
     my $expect = ($commit ? $pagename : "Editing $pagename");
-    unless (lc($headline) eq lc($expect)) {
+    my $pagenamefile = lc($pagename);
+    $pagenamefile =~ s/^image:/file:/;
+    my $expectfile = ($commit ? $pagenamefile : "Editing $pagenamefile");
+    unless (lc($headline) eq lc($expect) or lc($headline) eq lc($expectfile)) {
         WWW::Mediawiki::Client::CommitException->throw(
 	        error => "The page you are trying to commit appears to contain a link which is associated with Wikispam.",
                 res   => $res,
