You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When base_url is a string, this is a simple string concatenation. When base_url is a URI, + is an alias for merge which interprets a path beginning with / as absolute.
The text was updated successfully, but these errors were encountered:
alassek
added a commit
to alassek/hanami-router
that referenced
this issue
Jan 30, 2023
There are subtle differences in behavior depending on whether it is a
String or a URI. This patch forces it to be a URI and uses Prefix to
construct absolute URLs.
Fixeshanami#249
There are subtle differences in behavior depending on whether it is a
String or a URI. This patch forces it to be a URI and uses Prefix to
construct absolute URLs.
Fixeshanami#249
There are subtle differences in behavior depending on whether it is a
String or a URI. This patch forces it to be a URI and uses Prefix to
construct absolute URLs.
Fixeshanami#249
There are subtle differences in behavior depending on whether it is a
String or a URI. This patch forces it to be a URI and uses Prefix to
construct absolute URLs.
Fixes#249
Expected Result
Configuring a
base_url
with a path prefix should preserve it when generating URLsActual Result
When
base_url
is a URI object, the path prefix gets replaced by the route path.Further Context
There is a type mismatch in how
base_url
is being configured. In this project, it is being tested with a stringrouter/spec/unit/hanami/router/url_spec.rb
Lines 4 to 16 in a4f0242
However, in the framework proper the
base_url
configuration is being coerced to a URIhttps://github.com/hanami/hanami/blob/6780d4ea87b54ce543c8aa18fed0e46b8fbf84d6/lib/hanami/config.rb#L115-L128
The
UrlHelpers
class constructs a URL combiningbase_url
with the generated path using+
router/lib/hanami/router/url_helpers.rb
Lines 34 to 38 in a4f0242
When
base_url
is a string, this is a simple string concatenation. Whenbase_url
is a URI,+
is an alias formerge
which interprets a path beginning with/
as absolute.The text was updated successfully, but these errors were encountered: