Handle css and js files

Seto Elkahfi committed Jun 17, 2026 at 08:25 UTC 64df9c10cd50bba5ce5a4f65ba62f424db8bf884
2 files changed +12 -1
Gemfile.lock
+1 -1
@@ -373,7 +373,7 @@ DEPENDENCIES
373 redcarpet (~> 3.6)
374 rouge (~> 4.5)
375 rubocop-rails-omakase
376 - smbcloud-auth (~> 0.3.34)
376 + smbcloud-auth (~> 0.3.35)
377 solid_cable
378 solid_cache
379 solid_queue
app/controllers/blobs_controller.rb
+11
@@ -4,6 +4,15 @@ class BlobsController < ApplicationController
4 before_action :ensure_can_read!
5
6 def show
7 + # A file path like ".../app.js" or "...style.css" makes Rails negotiate a
8 + # non-HTML format from the trailing extension — which has no template (→
9 + # UnknownFormat) and, for ":js", also skips the HTML layout. Pinning the view
10 + # lookup formats governs both template and layout resolution; request.format
11 + # sets the response content type. Together they make any file type render as
12 + # a full, styled HTML page.
13 + request.format = :html
14 + lookup_context.formats = [ :html ]
15 +
16 @branch = params[:branch]
17 @file_path = params[:path]
18 @path_parts = @file_path.to_s.split("/").reject(&:blank?)
@@ -25,6 +34,8 @@ class BlobsController < ApplicationController
34 @highlighted_lines = highlight_lines(content, @filename)
35 @line_count = content.lines.count
36 end
37 +
38 + render :show
39 end
40
41 def raw