Defect #16881
closedGit: repository page crashes when non-ascii character in tag or branch name
0%
Description
If tag or branch name in git contains non-ascii character(ex."あ","い",etc.), Repository page crashes with the following messages in the production.log:
Started GET "/redmine/projects/XXX-000000/repository/git" for 127.0.0.1 at 2014-05-13 09:04:03 +0900 Processing by RepositoriesController#show as HTML Parameters: {"id"=>"XXX-000000", "repository_id"=>"git"} Current user: YYYYY (id=6) Rendered repositories/_navigation.html.erb (93.8ms) Rendered repositories/show.html.erb within layouts/base (93.8ms) Completed 500 Internal Server Error in 812.5ms ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT): app/views/repositories/_navigation.html.erb:24:in `block in _app_views_repositories__navigation_html_erb__875303464_30435480' app/views/repositories/_navigation.html.erb:13:in `_app_views_repositories__navigation_html_erb__875303464_30435480' app/views/repositories/show.html.erb:4:in `_app_views_repositories_show_html_erb___1026796241_22987116' app/controllers/repositories_controller.rb:125:in `show'
Atatched patch fixed the problem for me, but I'm not sure if it is a correct solution.
Environment: Redmine version 2.4.1.stable Ruby version 1.9.3-p231 (2012-05-25) [i386-mingw32] Rails version 3.2.16 Environment production Database adapter Mysql2 SCM: Git 1.8.3
Files
Related issues
Updated by qu al over 10 years ago
- File git_adapter.rb.patch git_adapter.rb.patch added
sorry, I forgot to attach the patch.
Updated by Tobias Fischer about 10 years ago
This also happens with 2.5.2.stable and I can confirm that the patch provided by "qu al" works fine.
Updated by Tobias Fischer almost 10 years ago
Updated by Toshi MARUYAMA almost 10 years ago
git_adapter.rb.patch cannot be accepted because it hard-code "UTF-8".
Redmine supports any encondings.
It needs more works.
Updated by Toshi MARUYAMA almost 10 years ago
Updated by Jonathan Wiens almost 10 years ago
Same problem here ...
Processing by RepositoriesController#show as HTML Parameters: {"id"=>"development"} Current user: jonw (id=4) Rendered repositories/_navigation.html.erb (175.1ms) Rendered repositories/_breadcrumbs.html.erb (2.8ms) Rendered repositories/_dir_list_content.html.erb (170.9ms) Rendered repositories/_dir_list.html.erb (172.4ms) Rendered repositories/_revision_graph.html.erb (4.9ms) Rendered repositories/_revisions.html.erb (207.9ms) Rendered repositories/show.html.erb within layouts/base (575.0ms) Completed 500 Internal Server Error in 5821.6ms ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT): 55: <%= yield :sidebar %> 56: <%= view_layouts_base_sidebar_hook_response %> 57: </div> 58: 59: <div id="content"> 60: <%= render_flash_messages %> 61: <%= yield %> app/views/layouts/base.html.erb:58:in `_app_views_layouts_base_html_erb___4435422814910722795_44338100' app/controllers/repositories_controller.rb:125:in `show'
When can we expect this issue to be resolved?
Updated by Toshi MARUYAMA almost 10 years ago
Jonathan Wiens wrote:
When can we expect this issue to be resolved?
git_adapter.rb.patch needs supporting any encoding and tests.
Updated by Jonathan Wiens over 9 years ago
Toshi MARUYAMA wrote:
Jonathan Wiens wrote:
When can we expect this issue to be resolved?
git_adapter.rb.patch needs supporting any encoding and tests.
Can someone do it?
Updated by Tobias Fischer over 9 years ago
- File git_adapter.rb.patch git_adapter.rb.patch added
Attached patch is for Redmine 3.0 (3.0.3 to be precise).
No further tests. It just works™ for me...
Updated by Toshi MARUYAMA about 9 years ago
- Has duplicate Defect #21141: Git tags and branches need to be UTF-8 encoded added
Updated by Toshi MARUYAMA about 9 years ago
Mercurial test covers non ASCII tag and branch.
source:tags/3.1.1/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb#L322
Git needs same test.
Updated by Holger Just about 9 years ago
While the proposed patch might not be 100% correct in all cases, it is still way better than just running into a hard error on rendering.
If you want to be better by detecting and rendering further encodings: fine. But by all means, please support the (at least) 80% case of UTF-8 branch names. For future work, you could repurpose @path_encoding
(which defaults to UTF-8).
In fact, it is probably safe enough to just call .force_encoding(@path_encoding)
and call it a day. This is most probably safe as git stores the names of tags and branches in the filesystem anyway so the encoding of path names is probably the same as the encoding of the branch names.
Still, please commit one of the fixes. Even it it still breaks on some edge-cases, it is way better than what we have now.
Updated by Kra Rom over 6 years ago
I will give this ticket a bump.
Error occurred in redmine 3.3.3.
Patch from Tobias Fischer worked.
My Environment:
Environment: Redmine version 3.3.3.stable Ruby version 2.2.7-p470 (2017-03-28) [x86_64-linux] Rails version 4.2.7.1 Environment production Database adapter Mysql2 SCM: Subversion 1.9.5 Git 2.11.0 Filesystem GitRemote 2.11.0 Redmine plugins: redmine_git_remote 0.0.1 scrum 0.17.0 ...
So:
Still, please commit one of the fixes. Even it it still breaks on some edge-cases, it is way better than what we have now.
?
Updated by Go MAEDA almost 6 years ago
- Related to Patch #30827: git tags can't handle utf-8 added
Updated by Toshi MARUYAMA over 5 years ago
- File branch-click.png branch-click.png added
- File branches.png branches.png added
- File log.txt log.txt added
- File tags.png tags.png added
- Status changed from New to Closed
- Target version set to 4.1.0
- Resolution set to Fixed