From 0d60b8c8235c3c07f675aba7a56dd37b62519f9e Mon Sep 17 00:00:00 2001 From: Joe Mou Date: Thu, 27 Aug 2026 14:08:06 -0400 Subject: Display PDF blobs GitHub renders a PDF with a viewer of its own and so ships no content for one, leaving the blob view with nothing to show. Its raw bytes come as application/octet-stream, which browsers download rather than display, so serve them from a new embed route that retypes them and point an at that. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01BErPR92xppzGFXkPqXPYj2 --- cgithub/views/blob.eta | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cgithub/views/blob.eta') diff --git a/cgithub/views/blob.eta b/cgithub/views/blob.eta index c7315f6..444508e 100644 --- a/cgithub/views/blob.eta +++ b/cgithub/views/blob.eta @@ -14,6 +14,11 @@ <% if (it.image) { %>
+<% } else if (it.renderFileType === "pdf") { %> + + This file cannot be displayed. + <% } else if (it.htmlContent) { %>
<%~ it.htmlContent %>
<% } else if (it.htmlLines) { %> @@ -21,5 +26,5 @@ <% } else if (it.textLines) { %>
<%= it.textLines.join("\n") %>
<% } else { %> -
This file cannot be displayed
+
This file cannot be displayed.
<% } %> -- cgit v1.3.1