From 980889f1bac4240095ce125d6bd386add8312003 Mon Sep 17 00:00:00 2001 From: vrana Date: Wed, 13 Feb 2013 00:33:14 -0800 Subject: [PATCH] Handle safe HTML in intraline renderer Test Plan: Used it in Phabricator. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4928 --- src/difference/ArcanistDiffUtils.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/difference/ArcanistDiffUtils.php b/src/difference/ArcanistDiffUtils.php index bff4f63c..5e02c6f6 100644 --- a/src/difference/ArcanistDiffUtils.php +++ b/src/difference/ArcanistDiffUtils.php @@ -123,6 +123,12 @@ final class ArcanistDiffUtils { $highlight_o = ''; $highlight_c = ''; + $is_html = false; + if ($str instanceof PhutilSafeHTML) { + $is_html = true; + $str = $str->getHTMLContent(); + } + $n = strlen($str); for ($i = 0; $i < $n; $i++) { @@ -176,6 +182,11 @@ final class ArcanistDiffUtils { $highlight = false; } } + + if ($is_html) { + return phutil_safe_html($buf); + } + return $buf; }