-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Change filter on /rails/info/routes to use an actual path regexp from rails #18434
Change filter on /rails/info/routes to use an actual path regexp from rails #18434
Conversation
69dbae8
to
7b7acae
Compare
@schneems what do you think? |
I've only given a cursory look at the PR but in general I agree with the direction. The conversion of Ruby compatible regexp to JS compatible is fragile and will be prone to errors. Also Another alternative will be to catch the error during conversion and revert back to original regexp. Basically if you get till the conversion the original regexp is fine but converting it is not working out so print the regex as-is. Of course this leads to inconsistency and might be surprising. |
Thanks for the work, and sorry for the delay. This is a pretty big change for a pretty small bug. As you noted, this page doesn't have any tests, so i've hesitant to merge in large changes. Moving the processing to the server side is a bit heavy handed. I'm 👎 on it as is. Can we modify the regex sanitizer to remove comments? |
The ruby regexp engine supports much more features than javascript version. If you worry about complex logic, then you shouldn't. I've removed more lines of code than I've added and the logic is straightforward. |
Also we want to make it possible to use the fuzzy match in the rake tasks On Wed, Feb 18, 2015, 21:33 Ravil Bayramgalin notifications@github.com
|
I'm convinced. I'll test out the implementation locally in the next day or so. Is there anyway to test any of this? Are we doing integration style tests on any of the other internal controllers? |
Maybe unit test in the fuzzy match class? But I think we have tests to the On Wed, Feb 18, 2015, 21:42 Richard Schneeman notifications@github.com
|
I verified and it works as promised. We should add a test to https://github.com/rails/rails/blob/master/railties/test/rails_info_controller_test.rb to test the results of querying for a partial and full match return as expected. This commit did break the routing error page: https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb Basically whenever you get a routing exception you get a very similar view to |
7fecb5c
to
f970850
Compare
@schneems Thank you for feedback! I've fixed the issue with And I've added tests. |
… rails Change filter on /rails/info/routes to use an actual path regexp from rails and not approximate javascript version. Oniguruma supports much more extensive list of features than javascript regexp engine. Fixes rails#18402.
f970850
to
321db4a
Compare
The error page works, your page works. I agree this is cleaner and simpler than my first version. Thanks for the PR, merging in ❤️ ❤️ ❤️ |
…routes Change filter on /rails/info/routes to use an actual path regexp from rails
Thank you 🙇 |
Change filter on
/rails/info/routes
to use an actual path regexp from railsand not approximate javascript version. Oniguruma supports much more
extensive list of features than javascript regexp engine.
Fixes #18402 (by removing json_regexp which breaks down on complex regexp patterns)
cc @schneems @rafaelfranca