]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Handle safe HTML in intraline renderer
authorvrana <jakubv@fb.com>
Wed, 13 Feb 2013 08:33:14 +0000 (00:33 -0800)
committervrana <jakubv@fb.com>
Wed, 13 Feb 2013 20:30:27 +0000 (12:30 -0800)
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

index bff4f63cef5ecd3f6269ab6b4b0b5e7636e6e8cd..5e02c6f64b6327be2576c58959d16b28025b2cc4 100644 (file)
@@ -123,6 +123,12 @@ final class ArcanistDiffUtils {
     $highlight_o = '<span class="bright">';
     $highlight_c = '</span>';
 
+    $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;
   }