| | }); |
| | |
| | - // We pass an empty filename '' because the blob view URL doesn't always contain the filename |
| | - $category = MediaTypeSniffer::isCategory($buffer, ''); |
| | - $mimeType = MediaTypeSniffer::isMediaType($buffer, ''); |
| | + // UPDATED: Retrieve the filename from the URL to assist detection |
| | + $filename = $_GET['name'] ?? ''; |
| | + $category = MediaTypeSniffer::isCategory($buffer, $filename); |
| | + $mimeType = MediaTypeSniffer::isMediaType($buffer, $filename); |
| | |
| | $this->renderBreadcrumbs($targetHash, 'File'); |
 |
| | $content = ''; |
| | $this->git->stream($targetHash, function($d) use (&$content) { $content .= $d; }); |
| | - echo '<div class="blob-content"><div class="blob-code">' . htmlspecialchars($content) . '</div></div>'; |
| | + // UPDATED: Changed from div to pre to preserve whitespace |
| | + echo '<div class="blob-content"><pre class="blob-code">' . htmlspecialchars($content) . '</pre></div>'; |
| | } else { |
| | $this->renderDownloadState($targetHash, "This is a binary file."); |
 |
| | } |
| | } |
| | + |
| | |