Page MenuHomePhabricator

D19306.diff
No OneTemporary

D19306.diff

diff --git a/src/applications/files/document/PhabricatorSourceDocumentEngine.php b/src/applications/files/document/PhabricatorSourceDocumentEngine.php
--- a/src/applications/files/document/PhabricatorSourceDocumentEngine.php
+++ b/src/applications/files/document/PhabricatorSourceDocumentEngine.php
@@ -24,18 +24,31 @@
protected function newDocumentContent(PhabricatorDocumentRef $ref) {
$content = $this->loadTextData($ref);
+ $messages = array();
+
$highlighting = $this->getHighlightingConfiguration();
if ($highlighting !== null) {
$content = PhabricatorSyntaxHighlighter::highlightWithLanguage(
$highlighting,
$content);
} else {
- $content = PhabricatorSyntaxHighlighter::highlightWithFilename(
- $ref->getName(),
- $content);
+ $highlight_limit = DifferentialChangesetParser::HIGHLIGHT_BYTE_LIMIT;
+ if (strlen($content) > $highlight_limit) {
+ $messages[] = $this->newMessage(
+ pht(
+ 'This file is larger than %s, so syntax highlighting was skipped.',
+ phutil_format_bytes($highlight_limit)));
+ } else {
+ $content = PhabricatorSyntaxHighlighter::highlightWithFilename(
+ $ref->getName(),
+ $content);
+ }
}
- return $this->newTextDocumentContent($content);
+ return array(
+ $messages,
+ $this->newTextDocumentContent($content),
+ );
}
}

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 22, 9:53 AM (5 h, 25 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7029279
Default Alt Text
D19306.diff (1 KB)

Event Timeline