diff --git a/lib/pleroma/web/fallback/redirect_controller.ex b/lib/pleroma/web/fallback/redirect_controller.ex
index 712991c18..1ac1319f8 100644
--- a/lib/pleroma/web/fallback/redirect_controller.ex
+++ b/lib/pleroma/web/fallback/redirect_controller.ex
@@ -41,8 +41,7 @@ defmodule Pleroma.Web.Fallback.RedirectController do
response =
index_content
- |> String.replace(~r/
.+?<\/title>/, title)
- |> String.replace("", tags <> preloads)
+ |> String.replace("", tags <> preloads <> title)
conn
|> put_resp_content_type("text/html")
@@ -60,8 +59,7 @@ defmodule Pleroma.Web.Fallback.RedirectController do
response =
index_content
- |> String.replace(~r/.+?<\/title>/, title)
- |> String.replace("", preloads)
+ |> String.replace("", preloads <> title)
conn
|> put_resp_content_type("text/html")
diff --git a/test/pleroma/web/fallback_test.exs b/test/pleroma/web/fallback_test.exs
index a65865860..46c7bad1c 100644
--- a/test/pleroma/web/fallback_test.exs
+++ b/test/pleroma/web/fallback_test.exs
@@ -20,15 +20,26 @@ defmodule Pleroma.Web.FallbackTest do
end
end
+ test "GET /*path adds a title", %{conn: conn} do
+ clear_config([:instance, :name], "a cool title")
+
+ assert conn
+ |> get("/")
+ |> html_response(200) =~ "a cool title"
+ end
+
describe "preloaded data and metadata attached to" do
test "GET /:maybe_nickname_or_id", %{conn: conn} do
+ clear_config([:instance, :name], "a cool title")
+
user = insert(:user)
user_missing = get(conn, "/foo")
user_present = get(conn, "/#{user.nickname}")
- assert(html_response(user_missing, 200) =~ "")
+ assert html_response(user_missing, 200) =~ ""
refute html_response(user_present, 200) =~ ""
assert html_response(user_present, 200) =~ "initial-results"
+ assert html_response(user_present, 200) =~ "a cool title"
end
test "GET /*path", %{conn: conn} do
@@ -44,10 +55,13 @@ defmodule Pleroma.Web.FallbackTest do
describe "preloaded data is attached to" do
test "GET /main/public", %{conn: conn} do
+ clear_config([:instance, :name], "a cool title")
+
public_page = get(conn, "/main/public")
refute html_response(public_page, 200) =~ ""
assert html_response(public_page, 200) =~ "initial-results"
+ assert html_response(public_page, 200) =~ "a cool title"
end
test "GET /main/all", %{conn: conn} do