Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/files/document/PhabricatorSourceDocumentEngine.php b/src/applications/files/document/PhabricatorSourceDocumentEngine.php
index cd7c2af92b..5a4b7f0be7 100644
--- a/src/applications/files/document/PhabricatorSourceDocumentEngine.php
+++ b/src/applications/files/document/PhabricatorSourceDocumentEngine.php
@@ -1,41 +1,54 @@
<?php
final class PhabricatorSourceDocumentEngine
extends PhabricatorTextDocumentEngine {
const ENGINEKEY = 'source';
public function getViewAsLabel(PhabricatorDocumentRef $ref) {
return pht('View as Source');
}
public function canConfigureHighlighting(PhabricatorDocumentRef $ref) {
return true;
}
protected function getDocumentIconIcon(PhabricatorDocumentRef $ref) {
return 'fa-code';
}
protected function getContentScore(PhabricatorDocumentRef $ref) {
return 1500;
}
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/x-diff
Expires
Wed, Jun 11, 12:36 AM (52 m, 35 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
141493
Default Alt Text
(1 KB)

Event Timeline