| | |
| | class FilePage extends BasePage { |
| | + private const MAX_HIGHLIGHT_SIZE = 65536; |
| | + private const MAX_DISPLAY_SIZE = 524288; |
| | + |
| | private $currentRepo; |
| | private $git; |
 |
| | if( !$file->renderMedia( $renderer, $rawUrl ) ) { |
| | if( $file->isText() ) { |
| | - if( $size > 524288 ) { |
| | + if( $size > self::MAX_DISPLAY_SIZE ) { |
| | ob_start(); |
| | $file->renderSize( $renderer ); |
 |
| | } ); |
| | |
| | - echo '<div class="blob-content"><pre class="blob-code">' . |
| | - $file->highlight( $renderer, $content ) . '</pre></div>'; |
| | + if( $size > self::MAX_HIGHLIGHT_SIZE ) { |
| | + echo '<div class="blob-content"><pre class="blob-code">' . |
| | + htmlspecialchars( $content ) . '</pre></div>'; |
| | + } else { |
| | + echo '<div class="blob-content"><pre class="blob-code">' . |
| | + $file->highlight( $renderer, $content ) . '</pre></div>'; |
| | + } |
| | } |
| | } else { |