jenkins-bot has submitted this change and it was merged.
Change subject: (bug 52313) Do not show text snippet with undecoded chars
......................................................................
(bug 52313) Do not show text snippet with undecoded chars
Change-Id: I1760c8ab3f313241965c93571f9637c5b0aeebc4
---
M includes/DiscussionParser.php
1 file changed, 10 insertions(+), 4 deletions(-)
Approvals:
EBernhardson (WMF): Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/DiscussionParser.php b/includes/DiscussionParser.php
index 80e7695..4b895aa 100644
--- a/includes/DiscussionParser.php
+++ b/includes/DiscussionParser.php
@@ -494,10 +494,10 @@
return substr( $text, 0, $timestampPos );
}
- // Strip off signature with HTML truncation method.
- // This way tags which are opened will be closed.
+ // Use truncate() instead of truncateHTML() because
truncateHTML()
+ // would not strip signature if the text conatins < or &
global $wgContLang;
- $truncated_text = $wgContLang->truncateHtml( $text, $output[0],
'' );
+ $truncated_text = $wgContLang->truncate( $text, $output[0], ''
);
return $truncated_text;
}
@@ -896,7 +896,13 @@
$text = trim( strip_tags( htmlspecialchars_decode( $text ) ) );
// strip out non-useful data for snippet
$text = str_replace( array( '{', '}' ), '', $text );
+ $text = $wgLang->truncate( $text, $length );
- return $wgLang->truncate( $text, $length );
+ // Return empty string if there is undecoded char left
+ if ( strpos( $text, '&#' ) !== false ) {
+ $text = '';
+ }
+
+ return $text;
}
}
--
To view, visit https://gerrit.wikimedia.org/r/77055
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1760c8ab3f313241965c93571f9637c5b0aeebc4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
Gerrit-Reviewer: EBernhardson (WMF) <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits