Skip to content

Commit

Permalink
Fix url_for when app is mapped to namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
bkeepers committed Mar 1, 2024
1 parent 966a956 commit 2b52b0f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/flipper/ui/action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,14 @@ def script_name
request.env['SCRIPT_NAME']
end

# Internal: Generate urls relative to the app's script name.
#
# url_for("feature") # => "http://localhost:9292/flipper/feature"
# url_for("/thing") # => "http://localhost:9292/thing"
# url_for("https://example.com") # => "https://example.com"
#
def url_for(*parts)
URI.join(request.base_url, script_name, *parts).to_s
URI.join(request.base_url, script_name + '/', *parts).to_s
end

# Private
Expand Down

0 comments on commit 2b52b0f

Please sign in to comment.