diff options
| author | Joe Mou <dev@mou.fo> | 2026-08-12 01:38:24 -0400 |
|---|---|---|
| committer | Joe Mou <dev@mou.fo> | 2026-08-12 01:42:59 -0400 |
| commit | ca23e43e0e95014ddd5f8d5e02e1118f5e2978f5 (patch) | |
| tree | 49a269b88f7f0d11e8102a60468f53252f033c4e /views | |
| parent | f491b436e4506a9a56a6a6c4313f4d41a0f3b890 (diff) | |
Handle blobs GitHub cannot preview
Binary files with no preview (a .ttf, say) have no rawLines, no
colorizedLines and no richText, so the blob view's final branch threw on
a null textLines and the page 500ed. Offer the raw file instead.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'views')
| -rw-r--r-- | views/blob.eta | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/views/blob.eta b/views/blob.eta index ed1e84b..c7315f6 100644 --- a/views/blob.eta +++ b/views/blob.eta @@ -8,7 +8,7 @@ <% } %> <div><%= it.size %></div> <div> - <a href="/<%= it.repo.owner %>/<%= it.repo.name %>/raw/<%= it.branch %>/<%= it.path %>">Raw</a> + <a href="/<%= it.repo.owner %>/<%= it.repo.name %>/raw/<%= it.branch %>/<%= it.path %>">View raw</a> </div> </div> @@ -18,6 +18,8 @@ <div class="box"><%~ it.htmlContent %></div> <% } else if (it.htmlLines) { %> <pre class="box"><code><%~ it.htmlLines.join("\n") %></code></pre> -<% } else { %> +<% } else if (it.textLines) { %> <pre class="box"><code><%= it.textLines.join("\n") %></code></pre> +<% } else { %> + <div class="box">This file cannot be displayed</div> <% } %> |
