Skip to content
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

In Ruby 3, the error "undefined method `decode' for URI:Module" occurs #9

Open
sk-ys opened this issue Nov 20, 2023 · 2 comments
Open

Comments

@sk-ys
Copy link
Contributor

sk-ys commented Nov 20, 2023

URI.decode method is removed on Ruby 3.

My Redmine environment is as follows.

Environment:
  Redmine version                5.1.0
  Ruby version                   3.1.4-p223 (2023-03-30) [x64-mingw-ucrt]
  Rails version                  6.1.7.6

The log at the time of the error occurrence is as follows.

Started GET "/product/projects/some_project_id/wiki" for 127.0.0.1 at 2023-11-21 07:32:13 +0900
Processing by WikiController#show as HTML
  Parameters: {"project_id"=>"some_project_id"}
  Current user: admin (id=1)
  Rendered wiki/show.html.erb within layouts/base (Duration: 160.3ms | Allocations: 24625)
  Rendered inline template (Duration: 0.5ms | Allocations: 282)
  Rendered layout layouts/base.html.erb (Duration: 270.4ms | Allocations: 56613)
Completed 500 Internal Server Error in 339ms (ActiveRecord: 31.9ms | Allocations: 72977)
  
ActionView::Template::Error (undefined method `decode' for URI:Module

        wiki_title = URI.decode(request.path.split("/").last)
                        ^^^^^^^):
    106:         <%= view_layouts_base_sidebar_hook_response %>
    107:     </div>
    108: 
    109:     <div id="content">
    110:         <%= render_flash_messages %>
    111:         <%= yield %>
    112:         <%= call_hook :view_layouts_base_content %>
  
plugins/like/lib/like/hooks.rb:35:in `view_layouts_base_content'
lib/redmine/hook.rb:66:in `block (2 levels) in call_hook'
lib/redmine/hook.rb:66:in `each'
lib/redmine/hook.rb:66:in `block in call_hook'
lib/redmine/hook.rb:63:in `call_hook'
lib/redmine/hook.rb:101:in `call_hook'
app/views/layouts/base.html.erb:109
lib/redmine/sudo_mode.rb:61:in `sudo_mode'
@seraph3000
Copy link

I think you should replace URI.decode with URI.decode_www_form or URI.encode_www_form_component.

@sk-ys
Copy link
Contributor Author

sk-ys commented Dec 10, 2023

Thank you. I create a pull request: #10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants