Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F36969477
0002-Remove-broken-link-processing-for-the-matched-text.patch
matmarex (Bartosz Dziewoński)
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
matmarex
Apr 29 2023, 2:16 PM
2023-04-29 14:16:15 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
0002-Remove-broken-link-processing-for-the-matched-text.patch
View Options
From 4397b58fe8d6db5265d858761754bf3a93c6bc7a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= <matma.rex@gmail.com>
Date: Sat, 29 Apr 2023 15:04:03 +0200
Subject: [PATCH 2/3] Remove broken link processing for the matched text
These regular expressions only match HTTP links. If no one noticed
that it's not working since we switched to HTTPS in 2015, then this
can't be important.
Change-Id: Ic48b83bf72785cbbd6d01ec763049d7e2a165cb2
---
includes/DoubleWiki.php | 23 -----------------------
1 file changed, 23 deletions(-)
diff --git a/includes/DoubleWiki.php b/includes/DoubleWiki.php
index ff632bc..4f33b35 100644
--- a/includes/DoubleWiki.php
+++ b/includes/DoubleWiki.php
@@ -131,29 +131,6 @@ class DoubleWiki implements OutputPageBeforeHTMLHook, BeforePageDisplayHook {
* @return string[] (new text, new translation)
*/
private function getMangledTextAndTranslation( string $text, string $translation, string $matchLangCode ): array {
- /**
- * first find all links that have no 'class' parameter.
- * these links are local so we add '?match=xx' to their url,
- * unless it already contains a '?'
- */
- $translation = preg_replace(
- "/<a href=\"http:\/\/([^\"\?]*)\"(([\s]+)(c(?!lass=)|[^c\>\s])([^\>\s]*))*\>/i",
- "<a href=\"http://\\1?match={$this->contentLanguage->getCode()}\"\\2>",
- $translation
- );
- // now add class='extiw' to these links
- $translation = preg_replace(
- "/<a href=\"http:\/\/([^\"]*)\"(([\s]+)(c(?!lass=)|[^c\>\s])([^\>\s]*))*\>/i",
- "<a href=\"http://\\1\" class=\"extiw\"\\3>",
- $translation
- );
- // use class='extiw' for images too
- $translation = preg_replace(
- "/<a href=\"http:\/\/([^\"]*)\"([^\>]*)class=\"image\"([^\>]*)\>/i",
- "<a href=\"http://\\1\"\\2class=\"extiw\"\\3>",
- $translation
- );
-
// add prefixes to internal links, in order to prevent duplicates
$translation = preg_replace(
"/<a href=\"#(.*?)\"/i",
--
2.28.0.windows.1
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
10808786
Default Alt Text
0002-Remove-broken-link-processing-for-the-matched-text.patch (1 KB)
Attached To
Mode
T323651: CVE-2023-37304: XSS in DoubleWiki extension (Wikisource)
Attached
Detach File
Event Timeline
Log In to Comment