Skip to content

Commit

Permalink
check path as well as host (#2043)
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyshull authored May 8, 2024
1 parent 0566f47 commit 7b1bd5d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/cms/api.ex
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,14 @@ defmodule CMS.Api do
end

defp set_redirect_options(uri) do
[external: parse_redirect_query(uri)]
base_url = Application.get_env(:dotcom, :cms_api)[:base_url]
file_path = "/sites/default/files"

if String.contains?(base_url, uri.host) and not String.contains?(uri.path, file_path) do
[to: uri |> internal_uri() |> parse_redirect_query()]
else
[external: parse_redirect_query(uri)]
end
end

@spec parse_redirect_query(URI.t()) :: String.t()
Expand Down

0 comments on commit 7b1bd5d

Please sign in to comment.