1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 08:42:41 +01:00

Fix overescaping in Paste

Summary:
Two issues:

  - When we read the content out of cache, it has lost its "safe html" flag, since the cache is raw-string oriented. Restore it.
  - explode() isn't safe-html-safe. Use phutil_split_lines() instead, which is.

Test Plan: Looked at /paste/

Reviewers: codeblock, chad

Reviewed By: codeblock

CC: aran

Differential Revision: https://secure.phabricator.com/D4980
This commit is contained in:
epriestley 2013-02-15 16:38:46 -08:00
parent 6c1043cf58
commit 02f7ece868
2 changed files with 2 additions and 2 deletions

View file

@ -44,7 +44,7 @@ abstract class PhabricatorPasteController extends PhabricatorController {
PhabricatorPaste $paste,
$max_lines = null) {
$lines = explode("\n", rtrim($paste->getContent()));
$lines = phutil_split_lines($paste->getContent());
return id(new PhabricatorSourceCodeView())
->setLimit($max_lines)

View file

@ -141,7 +141,7 @@ final class PhabricatorPasteQuery
foreach ($pastes as $paste) {
$key = $this->getContentCacheKey($paste);
if (isset($caches[$key])) {
$paste->attachContent($caches[$key]);
$paste->attachContent(phutil_safe_html($caches[$key]));
} else {
$need_raw[] = $paste;
}