From 44160c0db58a954c92c3dc912841a9acea4d74bf Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 3 Jul 2024 12:08:02 -0400 Subject: [PATCH] Fixes #37623 - Use html format in react controller for ics domains When having a domain with a .ics extension we get a ActionView::MissingTemplate: Missing template react/index error. This PR change forces the react controller to use the HTML format. With this change the host is able to be loaded in the UI. --- app/controllers/react_controller.rb | 2 +- test/integration/host_test.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/react_controller.rb b/app/controllers/react_controller.rb index 628bc8db9c7..e44983ce223 100644 --- a/app/controllers/react_controller.rb +++ b/app/controllers/react_controller.rb @@ -4,6 +4,6 @@ class ReactController < ApplicationController def index response.headers['X-Request-Path'] = request.path - render 'react/index' + render("react/index", formats: [:html]) end end diff --git a/test/integration/host_test.rb b/test/integration/host_test.rb index 1a6ae0726a3..5676f0eb2a3 100644 --- a/test/integration/host_test.rb +++ b/test/integration/host_test.rb @@ -13,6 +13,14 @@ class HostIntegrationTest < ActionDispatch::IntegrationTest assert page.has_link?('Export', href: current_hosts_path(format: 'csv', search: "name = #{@host.name}")) end + describe "view host page" do + test "host with .ics extension" do + domain = FactoryBot.create(:domain, name: 'example.ics') + host = FactoryBot.create(:host, domain: domain) + visit host_details_page_path(host) + end + end + describe "create new host page" do test "tabs are present" do assert_new_button(current_hosts_path, "Create Host", new_host_path)