Page MenuHomePhabricator

0001-Apply-output-escaping-conditionally.patch

Authored By
bzimport
Nov 22 2014, 2:23 AM
Size
1 KB
Referenced Files
None
Subscribers
None

0001-Apply-output-escaping-conditionally.patch

From 45b68827409204f01840898445a8677dcf080ce2 Mon Sep 17 00:00:00 2001
From: dr0ptp4kt <abaso@wikimedia.org>
Date: Tue, 22 Oct 2013 16:46:28 -0700
Subject: [PATCH] Apply output escaping conditionally.
Change-Id: Ie301c3c27c55dfb0f4d3c653785ad0a35a532a95
---
includes/ZeroSpecialPage.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/includes/ZeroSpecialPage.php b/includes/ZeroSpecialPage.php
index c8fef00..03ea4ac 100644
--- a/includes/ZeroSpecialPage.php
+++ b/includes/ZeroSpecialPage.php
@@ -55,7 +55,9 @@ class ZeroSpecialPage extends UnlistedSpecialPage {
if ( !array_key_exists( 'warn', $redir ) ) {
if ( array_key_exists( 'softredirect', $redir ) ) {
$r = $redir['softredirect'];
- $output = Html::element( 'a', array( 'href' => $r ), $r );
+ $rSafe = preg_match( '/^(http(s?):\/\/|\/\/)/i', $r );
+ $r = $rSafe ? wfUrlencode( $r ) : urlencode( $r );
+ $output = '<a href="' . $r . '">' . htmlentities( $r ) . '</a>';
$out->addHTML( $output );
} else {
$config = $this->state->getConfig();
--
1.8.3.4 (Apple Git-47)

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
11698
Default Alt Text
0001-Apply-output-escaping-conditionally.patch (1 KB)

Event Timeline