Skip to content

Commit e469bf7

Browse files
committed
Fix rendering of static assets
1 parent 70d78d5 commit e469bf7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app/controllers/yard_controller.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,20 @@ def respond
7474
expires_in 1.day, public: true
7575
end
7676

77-
if status == 200 && !request.path.starts_with?("/search") && !request.path.starts_with?("/static")
77+
if use_template?
7878
render :show
7979
else
8080
render plain: body.first, status: status, headers: headers, content_type: headers["Content-Type"]
8181
end
8282
end
8383

84+
def use_template?
85+
return false if status != 200
86+
return false if %w[/search /static].any? { |path| request.path.starts_with?(path) }
87+
return false if params[:rest].to_s.starts_with?("file/")
88+
true
89+
end
90+
8491
def visit_library
8592
FileUtils.touch(library_version.source_path)
8693
end

0 commit comments

Comments
 (0)