This has been bothering me for a while. I can't recall the specifics, but every now and then I get the following error in my local environment: ``` NoMethodError - undefined method 'parse' for class CGI: app/controllers/concerns/session_methods.rb:14:in `parse_oauth_referer' app/controllers/sessions_controller.rb:24:in `new' config/initializers/policy_headers.rb:13:in `call' config/initializers/compressed_requests.rb:33:in `call' ``` Typically when switching DBs (eg: between a Docker setup and a "normal" setup) or something like that. I tend to do a quick fix (can't be sure what I do, just smack it a bit until it works) and move on, always thinking I'll look into it later.
Finally yesterday I was playing with OAuth and got a very reproducible case, and here I am with a fix. The problem: crash when attempting to login in with a `referer` query param that in turn includes query params. This is common with OAuth. No idea if it happens anywhere else in the app, which still has me scratching my head as I've seen it happen in less esoteric contexts. The reason: we parse the referer param with `CGI.param`, but that function doesn't exist. Why doesn't production break? Because the CGI library is fully present in Ruby 3.x. [It was removed in Ruby 4](https://bugs.ruby-lang.org/issues/21258) ([release notes](https://www.ruby-lang.org/en/news/2025/12/25/ruby-4-0-0-released/#stdlib-compatibility-issues)), so this is a crash waiting to happen. The fix: add `cgi` to the Gemfile. You can view, comment on, or merge this pull request online at: https://github.com/openstreetmap/openstreetmap-website/pull/7106 -- Commit Summary -- * Fix crash due to cgi gem not fully loaded -- File Changes -- M Gemfile (3) M Gemfile.lock (2) M test/integration/oauth2_test.rb (8) -- Patch Links -- https://github.com/openstreetmap/openstreetmap-website/pull/7106.patch https://github.com/openstreetmap/openstreetmap-website/pull/7106.diff -- Reply to this email directly or view it on GitHub: https://github.com/openstreetmap/openstreetmap-website/pull/7106 You are receiving this because you are subscribed to this thread. Message ID: <openstreetmap/openstreetmap-website/pull/[email protected]>
_______________________________________________ rails-dev mailing list [email protected] https://lists.openstreetmap.org/listinfo/rails-dev
