Defect #16881
Git: repository page crashes when non-ascii character in tag or branch name
Status: | Closed | Start date: | ||
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | % Done: | 0% | ||
Category: | SCM | |||
Target version: | 4.1.0 | |||
Resolution: | Fixed | Affected version: |
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
Related issues
Associated revisions
add :environment to test:scm:setup:create_dir and test:scm:update rake tasks (#16881)
split method for scm test repository extracting (#16881)
scm: git: add new two latin1 branches to test repository (#16881)
scm: git: add new one latin1 tag to test repository (#16881)
scm: git: fix non ascii branch and tag browsing (#16881)
History
#1
Updated by qu al about 8 years ago
- File git_adapter.rb.patch
added
sorry, I forgot to attach the patch.
#2
Updated by Toshi MARUYAMA about 8 years ago
- Assignee set to Toshi MARUYAMA
#3
Updated by Tobias Fischer almost 8 years ago
This also happens with 2.5.2.stable and I can confirm that the patch provided by "qu al" works fine.
#4
Updated by Tobias Fischer over 7 years ago
#5
Updated by Toshi MARUYAMA over 7 years ago
git_adapter.rb.patch cannot be accepted because it hard-code "UTF-8".
Redmine supports any encondings.
It needs more works.
#6
Updated by Toshi MARUYAMA over 7 years ago
#7
Updated by Jonathan Wiens over 7 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?
#8
Updated by Toshi MARUYAMA over 7 years ago
Jonathan Wiens wrote:
When can we expect this issue to be resolved?
git_adapter.rb.patch needs supporting any encoding and tests.
#9
Updated by Jonathan Wiens over 7 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?
#10
Updated by Tobias Fischer about 7 years ago
- File 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...
#11
Updated by Toshi MARUYAMA almost 7 years ago
- Duplicated by Defect #21141: Git tags and branches need to be UTF-8 encoded added
#12
Updated by Toshi MARUYAMA almost 7 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.
#13
Updated by Holger Just almost 7 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.
#14
Updated by Kra Rom over 4 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.
?
#15
Updated by Go MAEDA over 3 years ago
- Related to Patch #30827: git tags can't handle utf-8 added
#16
Updated by Toshi MARUYAMA over 3 years ago
- File branch-click.png added
- File branches.png added
- File log.txt
added
- File tags.png added
- Status changed from New to Closed
- Target version set to 4.1.0
- Resolution set to Fixed