-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sinatra::Namespace nesting similarly-named namespaces #1251
Comments
Here is a workaround for Sinatra 2.0+: namespace %r{/foo(?![^/])} do Or: namespace %r{/foo\b} do Unfortunately, it breaks nested namespaces under Sinatra 1.4.8 (even, weirdly, with Mustermann), so I'll need something better for my own purposes. |
@mwpastore Are you seeing this without Mustermann? |
@zzak With and without Mustermann on 1.4.8. |
Well, that sucks.. but if the behavior is the same between 1.x and 2.x then we can at least mark it as a known issue. |
@mwpastore Could you confirm #1253? |
Still trying to wrap my brain around this but wanted to get an issue going for feedback, particularly from @zzak since he rewrote Sinatra::Namespace for 2.0 and is hopefully familiar with its inner-workings. 😄
Take the following sample application:
Expected output:
Actual output:
Although the two routes are in two separate namespaces, and hence, ostensibly, in two separate modules, it appears as though the latter is nested under the former. This only happens when the longer route starts with the same string as the shorter route; i.e. if the second namespace were named simply
/bar
, this issue would not manifest.I can confirm this issue is present in Sinatra 1.4.8 (with and without Mustermann), 2.0.0.beta2, and master tip.
The text was updated successfully, but these errors were encountered: