epitron / redmine_ultraviolet

Advanced syntax highlighting for Redmine source code repositories (using Ultraviolet, which is based on Textmate syntax files).
Other
60 stars 20 forks source link

fixes for redmine 1.3.0+ #14

Closed asiyanko closed 12 years ago

asiyanko commented 12 years ago

It turned out that plugin doesn't work with Redmine 1.3.0. An attempt to view a file displays internal server error and logs the following message:

ActionView::TemplateError (undefined method `to_utf8' for #) on line #15 of vendor/plugins/redmine_ultraviolet/app/views/common/_file.rhtml:
...
...

vendor/plugins/redmine_ultraviolet/app/views/common/_file.rhtml:15:in `_run_rhtml_vendor47plugins47redmine_ultraviolet47app47views47common47_file46rhtml_locals_content_file_filename_object'
    app/views/repositories/entry.html.erb:11
    config/initializers/mongrel.rb:77:in `dispatch_cgi'

Rendering /usr/local/redmine/1.3.0-8180/public/500.html (500 Internal Server Error)

To fix this all 'to_utf8' calls in rhtml-files under app/views directory should be changed to 'Redmine::CodesetUtil.to_utf8_by_setting'

epitron commented 12 years ago

Hmmm... would this Redmine::CodesetUtil.to_utf8_by_setting command work in the earlier versions of redmine (1.0, 0.8, etc.)?

asiyanko commented 12 years ago

No this will not work in earlier versions, even 1.2. Look at changesets 7871, 7828, 7825, 7818, 7810 for details. Unfortunately I don't have much expertise in Ruby neither I have deep knowledge of Redmine sources, since I'm just an ordinary Redmine user. I've just tracked code changes, when I found out, that the plugin doesn't work any more after I upgraded from 1.2.1 to 1.3.0. So I've just suggested a quick fix.

epitron commented 12 years ago

Oh! According to these changelogs, to_utf8 is just calling Redmine::CodesetUtil.to_utf8_by_setting(str). That should mean that this method works in versions 1.0 and 0.8 as well. I'll look into this.

asiyanko commented 12 years ago

yes, it looks like this according to changeset 7825, but then in 7871 they just got rid of to_utf8() method in all helpers so there is no such method with one parameter anymore. Instead, to_utf8() in codeset_util.rb has 2 parameters - 'str' and 'encoding'.

epitron commented 12 years ago

Okay, so I committed this fix. I hope it doesn't break anything -- I don't have a redmine install to test on. :(