Brian Wolff has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/226724

Change subject: Fix double escaping in special:log/gwtoolset
......................................................................

Fix double escaping in special:log/gwtoolset

Note the <a> tag (from calling ->parse on the message) in
https://commons.wikimedia.org/?title=Special:Log&offset=20150724115413&type=gwtoolset&user=Jason.nlw&limit=2

Note the surounding of things by < > in
https://commons.wikimedia.org/?title=Special:Log&type=gwtoolset&user=Jason.nlw&offset=20150724122545&limit=1
caused by giving status::newFatal the results of wfMessage( .. )->text()
instead of the message name like its supposed to take.

Ideally this would be modified to have the messages expanded by
the log handler (Like newstyle logs), but that's a much larger
change, and I'd first like to just get the escaped html out
of the log view.

Bug: T87044
Change-Id: I72123fde8e8aad9401ca861f057acd946f1c8d93
---
M includes/GWTException.php
M includes/Handlers/UploadHandler.php
2 files changed, 15 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GWToolset 
refs/changes/24/226724/1

diff --git a/includes/GWTException.php b/includes/GWTException.php
index 8875c82..9c7874a 100644
--- a/includes/GWTException.php
+++ b/includes/GWTException.php
@@ -44,14 +44,16 @@
 
                if ( is_array( $message ) ) {
                        foreach ( $message as $key => $params ) {
-                               $result .= wfMessage( $key )->params( $params 
)->parse();
+                               $result .= wfMessage( $key )->params( $params 
)->text();
                        }
-               } else if ( strpos( $message, 'gwtoolset-' ) !== false ) {
-                       $result .= wfMessage( $message )->parse();
+               } else if ( strpos( $message, 'gwtoolset-' ) === 0 ) {
+                       $result .= wfMessage( $message )->text();
                } else {
-                       $result = Sanitizer::removeHTMLtags( $message );
+                       $result = $message;
                }
 
+               $result = Sanitizer::removeHTMLtags( $result );
+
                return $result;
        }
 
diff --git a/includes/Handlers/UploadHandler.php 
b/includes/Handlers/UploadHandler.php
index 926008c..d9a434a 100644
--- a/includes/Handlers/UploadHandler.php
+++ b/includes/Handlers/UploadHandler.php
@@ -244,24 +244,18 @@
                        if ( $warnings['exists']['warning'] === 'exists' ) {
                                // check if another contributor has altered 
this title
                                if ( $this->otherContributors( $title ) ) {
-                                       $msg =
-                                               wfMessage( 
'gwtoolset-mediafile-other-contributors' )
-                                                       ->params( 
$warnings['exists']['file']->getTitle() )
-                                                       ->text();
-
-                                       $status = Status::newFatal( $msg );
+                                       $status = Status::newFatal( 
'gwtoolset-mediafile-other-contributors',
+                                               
$warnings['exists']['file']->getTitle()
+                                       );
 
                                // this title’s most recent mediafile is the 
same as the one being uploaded
                                } else if (
                                        $upload->getTempFileSha1Base36() ===
                                        $warnings['exists']['file']->getSha1()
                                ) {
-                                       $msg =
-                                               wfMessage( 
'gwtoolset-mediafile-duplicate-same-title' )
-                                                       ->params( 
$warnings['exists']['file']->getTitle() )
-                                                       ->text();
-
-                                       $status = Status::newFatal( $msg );
+                                       $status = Status::newFatal( 
'gwtoolset-mediafile-duplicate-same-title',
+                                               
$warnings['exists']['file']->getTitle()
+                                       );
                                }
                        }
                }
@@ -272,12 +266,9 @@
                        && isset( $warnings['duplicate'] )
                        && count( $warnings['duplicate'] ) > 0
                ) {
-                       $msg =
-                               wfMessage( 
'gwtoolset-mediafile-duplicate-another-title' )
-                                       ->params( 
$warnings['duplicate'][0]->getTitle() )
-                                       ->text();
-
-                       $status = Status::newFatal( $msg );
+                       $status = Status::newFatal( 
'gwtoolset-mediafile-duplicate-another-title',
+                               $warnings['duplicate'][0]->getTitle()
+                       );
                }
 
                return $status;

-- 
To view, visit https://gerrit.wikimedia.org/r/226724
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I72123fde8e8aad9401ca861f057acd946f1c8d93
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GWToolset
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to