Project

General

Profile

Actions

Defect #25846

closed

Repository directory listing: ActionView::Template::Error (incompatible character encodings: ASCII-8BIT and UTF-8)

Added by Marc Vollmer over 7 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
SCM
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

Hello,

we have added 4 repositories (Git Remote) as projectarchvies to redmine.
When we open those repositories in the projectarchive view 3 of them work, one gives the following error:

Started GET "/projects/XXX/repository/XXX" for XXX.XXX.XXX.XXX at 2017-05-15 10:10:00 +0200
Processing by RepositoriesController#show as HTML
  Parameters: {"id"=>"XXX", "repository_id"=>"XXX"}
  Current user: XXX (id=135)
  Rendered repositories/_navigation.html.erb (38.5ms)
  Rendered repositories/_breadcrumbs.html.erb (0.9ms)
  Rendered repositories/_dir_list_content.html.erb (10.4ms)
  Rendered repositories/_dir_list.html.erb (10.9ms)
  Rendered repositories/show.html.erb within layouts/base (53.8ms)
Completed 500 Internal Server Error in 168ms (ActiveRecord: 3.5ms)

ActionView::Template::Error (incompatible character encodings: ASCII-8BIT and UTF-8):
     8:                :locals => { :path => @path, :kind => 'dir', :revision => @rev } %></h2>
     9:
    10: <% if !@entries.nil? && authorize_for('repositories', 'browse') %>
    11:   <%= render :partial => 'dir_list' %>
    12: <% end %>
    13:
    14: <%= render_properties(@properties) %>
  app/views/repositories/show.html.erb:11:in `_app_views_repositories_show_html_erb__1302325350339252382_70155590060320'
  app/controllers/repositories_controller.rb:125:in `show'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

My first guess was that theres a directory of file in the repository that has an invalid char as a name, so I wrote a little script to check all filenames against a regex and we just found a file containing a ~ in the name.

We had this repository working before, so the file must be added in the last 1 to 2 month but the file containing the ~ was added 2 years ago.

I already tried to re add the repository with no success and other repositories I added as a test also work.

Thanks for your help in advance!


Files

2.png (10.8 KB) 2.png Toshi MARUYAMA, 2017-05-15 12:27
1.png (12.7 KB) 1.png Toshi MARUYAMA, 2017-05-15 12:27
Actions #1

Updated by Toshi MARUYAMA over 7 years ago

I cannot reproduce.


$ rpm -q git
git-1.8.3.1-6.el7_2.1.x86_64
Actions #2

Updated by Marc Vollmer over 7 years ago

We have multiple repositories (4 configured) 3 work 1 not, as stated it's definitely not the ~ because it's been there for too long and theres also one working repository that also has a ~ in a file name.

We checked all files and directories against the following regex and they all match: ^[a-zA-Z0-9._\-$ ~]+$
So no files with unusual chars in the name.

As a reference the git version:

# zypper if git-core
Refreshing service 'SUSE_Linux_Enterprise_Server_12_SP2_x86_64'.
Refreshing service 'SUSE_Linux_Enterprise_Software_Development_Kit_12_SP2_x86_64'.
Loading repository data...
Reading installed packages...

Information for package git-core:
---------------------------------
Repository     : SLES12-SP2-Updates
Name           : git-core
Version        : 2.12.0-23.1
Arch           : x86_64
Vendor         : SUSE LLC <https://www.suse.com/>
Support Level  : Level 3
Installed Size : 29.5 MiB
Installed      : Yes
Status         : out-of-date (version 1.8.5.6-18.1 installed)
Summary        : Core git tools
Description    :
    Git is a fast, scalable, distributed revision control system with an
    unusually rich command set that provides both high-level operations and
    full access to internals.

    These are the core tools with minimal dependencies.

Commits with Ticket ID's are referenced in tickets, so scanning also works.

Actions #3

Updated by Luc Lalonde about 7 years ago

We're also seeing this error:

ActionView::Template::Error (incompatible character encodings: ASCII-8BIT and UTF-8):
    27:                    :id => 'tag' %>
    28:   <% end -%>
    29: 
    30:   <% if @repository.supports_all_revisions? %>
    31:     | <%= l(:label_revision) %>: 
    32:     <%= text_field_tag 'rev', @rev, :size => 8 %>
    33:   <% end %>
  app/views/repositories/_navigation.html.erb:30:in `block in _app_views_repositories__navigation_html_erb__965151315351232331_69898529566340'
  app/views/repositories/_navigation.html.erb:9:in `_app_views_repositories__navigation_html_erb__965151315351232331_69898529566340'
  app/views/repositories/show.html.erb:4:in `_app_views_repositories_show_html_erb___2125122647801616403_69898529468540'
  app/controllers/repositories_controller.rb:125:in `show'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

This patch solves the problem:

[root@githost adapters]# pwd
/var/www/redmine/lib/redmine/scm/adapters
[root@githost adapters]# diff git_adapter.rb git_adapter.rb.bak2017-10-05 
89d88
<             bran.force_encoding("UTF-8") if bran.respond_to?(:force_encoding)
103,108c102
< #            @tags = io.readlines.sort!.map{|t| t.strip}
<              @tags = io.readlines.sort!.map do |tag|
<                        tag = tag.strip
<                        tag.force_encoding("UTF-8") if tag.respond_to?(:force_encoding)
<                        tag
<                      end
---
>             @tags = io.readlines.sort!.map{|t| t.strip}

Here's the link for the original reference:

https://stackoverflow.com/questions/42804760/error-in-repository-view-redmin-actionviewtemplateerror-incompatible-charac

Hope this can lea

Actions #4

Updated by Luc Lalonde about 7 years ago

Forgot these details:

Environment:
  Redmine version                3.3.3.stable
  Ruby version                   2.3.1-p112 (2016-04-26) [x86_64-linux]
  Rails version                  4.2.7.1
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.7.14
  Git                            1.8.3.1
  Filesystem                     
Redmine plugins:
  redmine_ldap_sync              2.0.8.devel.gf916e6574e
  timesheet                      0.7.0
Actions #5

Updated by leonid terekhov almost 7 years ago

Luc Lalonde wrote:

We're also seeing this error:

[...]

This patch solves the problem:

[...]

Here's the link for the original reference:

https://stackoverflow.com/questions/42804760/error-in-repository-view-redmin-actionviewtemplateerror-incompatible-charac

Hope this can lea

Thank you! It works for me.

Actions #6

Updated by Jan Hohmann over 6 years ago

We have the same problem.

Can this fix please be merged into the next release?

Affected Version: 3.4.5

Actions #7

Updated by S. Ruttloff over 5 years ago

We had the same problem with Redmine 3.3.1 and could fix it with the patch.

Thanks

Actions #8

Updated by Toshi MARUYAMA almost 5 years ago

  • Status changed from Needs feedback to Closed

I think this issue was fixed by #16881 and add a test (r19534).

Actions

Also available in: Atom PDF