From 94c7a850f400140f8f9364bebb54ce89841525d4 Mon Sep 17 00:00:00 2001 From: Ivan Kuchin Date: Mon, 17 Nov 2025 17:00:05 +0100 Subject: [PATCH] hack to resolve base tag conflicting with openapi explorer by not inserting the tag for that page openapi explorer uses replaceState (pushState in later versions) with anchor only, but this doesn't work with base tag, as anchor is added to the base url instead of current url. So don't insert the tag on exploror page --- app/controllers/api_docs_controller.rb | 2 ++ app/views/layouts/_common_head.html.erb | 4 +++- app/views/layouts/base.html.erb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/api_docs_controller.rb b/app/controllers/api_docs_controller.rb index 703053f05d3b..c8af4c7ed1c1 100644 --- a/app/controllers/api_docs_controller.rb +++ b/app/controllers/api_docs_controller.rb @@ -36,5 +36,7 @@ class APIDocsController < ApplicationController def index render_404 unless Setting.apiv3_docs_enabled? + + render locals: { skip_base_tag: true } end end diff --git a/app/views/layouts/_common_head.html.erb b/app/views/layouts/_common_head.html.erb index 632134ff6a33..9235707139cd 100644 --- a/app/views/layouts/_common_head.html.erb +++ b/app/views/layouts/_common_head.html.erb @@ -6,7 +6,9 @@ <% relative_url_root = OpenProject::Configuration["rails_relative_url_root"] || "" %> - +<% unless local_assigns[:skip_base_tag] %> + +<% end %> <% if @project %> "> - <%= render partial: "layouts/common_head" %> + <%= render partial: "layouts/common_head", locals: local_assigns %> <%= call_hook :view_layouts_base_html_head %>