@@ -0,0 +1,13 | |||
|
1 | Index: trunk/app/controllers/issues_controller.rb | |
|
2 | =================================================================== | |
|
3 | --- trunk/app/controllers/issues_controller.rb (révision 1483) | |
|
4 | +++ trunk/app/controllers/issues_controller.rb (révision 1484) | |
|
5 | @@ -149,7 +149,7 @@ | |
|
6 | attach_files(@issue, params[:attachments]) | |
|
7 | flash[:notice] = 'Demande créée avec succès' | |
|
8 | Mailer.deliver_issue_add(@issue) if Setting.notified_events.include?('issue_added') | |
|
9 | - redirect_to :controller => 'issues', :action => 'show', :id => @issue, :project_id => @project | |
|
10 | + redirect_to :controller => 'issues', :action => 'show', :id => @issue | |
|
11 | return | |
|
12 | end | |
|
13 | end |
@@ -29,6 +29,12 module AttachmentsHelper | |||
|
29 | 29 | end |
|
30 | 30 | |
|
31 | 31 | def to_utf8(str) |
|
32 | return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii | |
|
33 | begin | |
|
34 | Iconv.conv('UTF-8//IGNORE', 'UTF-8', str + ' ')[0..-3] | |
|
35 | rescue Iconv::InvalidEncoding | |
|
36 | # "UTF-8//IGNORE" is not supported on some OS | |
|
32 | 37 | str |
|
33 | 38 | end |
|
34 | 39 | end |
|
40 | end |
@@ -4,7 +4,7 | |||
|
4 | 4 | <% if diff_type == 'sbs' -%> |
|
5 | 5 | <table class="filecontent"> |
|
6 | 6 | <thead> |
|
7 | <tr><th colspan="4" class="filename"><%= table_file.file_name %></th></tr> | |
|
7 | <tr><th colspan="4" class="filename"><%=to_utf8 table_file.file_name %></th></tr> | |
|
8 | 8 | </thead> |
|
9 | 9 | <tbody> |
|
10 | 10 | <% prev_line_left, prev_line_right = nil, nil -%> |
@@ -31,7 +31,7 | |||
|
31 | 31 | <% else -%> |
|
32 | 32 | <table class="filecontent syntaxhl"> |
|
33 | 33 | <thead> |
|
34 | <tr><th colspan="3" class="filename"><%= table_file.file_name %></th></tr> | |
|
34 | <tr><th colspan="3" class="filename"><%=to_utf8 table_file.file_name %></th></tr> | |
|
35 | 35 | </thead> |
|
36 | 36 | <tbody> |
|
37 | 37 | <% prev_line_left, prev_line_right = nil, nil -%> |
@@ -54,11 +54,11 attachments_005: | |||
|
54 | 54 | container_type: Issue |
|
55 | 55 | container_id: 3 |
|
56 | 56 | downloads: 0 |
|
57 | disk_filename: 060719210727_changeset.diff | |
|
57 | disk_filename: 060719210727_changeset_iso8859-1.diff | |
|
58 | 58 | digest: b91e08d0cf966d5c6ff411bd8c4cc3a2 |
|
59 | 59 | id: 5 |
|
60 | 60 | filesize: 687 |
|
61 | filename: changeset.diff | |
|
61 | filename: changeset_iso8859-1.diff | |
|
62 | 62 | author_id: 2 |
|
63 | 63 | content_type: text/x-diff |
|
64 | 64 | attachments_006: |
@@ -157,3 +157,15 attachments_013: | |||
|
157 | 157 | filename: foo.zip |
|
158 | 158 | author_id: 2 |
|
159 | 159 | content_type: application/octet-stream |
|
160 | attachments_014: | |
|
161 | created_on: 2006-07-19 21:07:27 +02:00 | |
|
162 | container_type: Issue | |
|
163 | container_id: 3 | |
|
164 | downloads: 0 | |
|
165 | disk_filename: 060719210727_changeset_utf8.diff | |
|
166 | digest: b91e08d0cf966d5c6ff411bd8c4cc3a2 | |
|
167 | id: 14 | |
|
168 | filesize: 687 | |
|
169 | filename: changeset_utf8.diff | |
|
170 | author_id: 2 | |
|
171 | content_type: text/x-diff |
@@ -1,10 +1,10 | |||
|
1 | 1 | Index: trunk/app/controllers/issues_controller.rb |
|
2 | 2 | =================================================================== |
|
3 | --- trunk/app/controllers/issues_controller.rb (r�vision 1483) | |
|
4 | +++ trunk/app/controllers/issues_controller.rb (r�vision 1484) | |
|
3 | --- trunk/app/controllers/issues_controller.rb (r�vision 1483) | |
|
4 | +++ trunk/app/controllers/issues_controller.rb (r�vision 1484) | |
|
5 | 5 | @@ -149,7 +149,7 @@ |
|
6 | 6 | attach_files(@issue, params[:attachments]) |
|
7 |
flash[:notice] = |
|
|
7 | flash[:notice] = 'Demande cr��e avec succ�s' | |
|
8 | 8 | Mailer.deliver_issue_add(@issue) if Setting.notified_events.include?('issue_added') |
|
9 | 9 | - redirect_to :controller => 'issues', :action => 'show', :id => @issue, :project_id => @project |
|
10 | 10 | + redirect_to :controller => 'issues', :action => 'show', :id => @issue |
@@ -1,5 +1,7 | |||
|
1 | # redMine - project management software | |
|
2 | # Copyright (C) 2006-2008 Jean-Philippe Lang | |
|
1 | # encoding: utf-8 | |
|
2 | # | |
|
3 | # Redmine - project management software | |
|
4 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |
|
3 | 5 | # |
|
4 | 6 | # This program is free software; you can redistribute it and/or |
|
5 | 7 | # modify it under the terms of the GNU General Public License |
@@ -35,10 +37,31 class AttachmentsControllerTest < ActionController::TestCase | |||
|
35 | 37 | end |
|
36 | 38 | |
|
37 | 39 | def test_show_diff |
|
38 | get :show, :id => 5 | |
|
40 | get :show, :id => 14 # 060719210727_changeset_utf8.diff | |
|
41 | assert_response :success | |
|
42 | assert_template 'diff' | |
|
43 | assert_equal 'text/html', @response.content_type | |
|
44 | ||
|
45 | assert_tag 'th', | |
|
46 | :attributes => {:class => /filename/}, | |
|
47 | :content => /issues_controller.rb\t\(révision 1484\)/ | |
|
48 | assert_tag 'td', | |
|
49 | :attributes => {:class => /line-code/}, | |
|
50 | :content => /Demande créée avec succès/ | |
|
51 | end | |
|
52 | ||
|
53 | def test_show_diff_should_strip_non_utf8_content | |
|
54 | get :show, :id => 5 # 060719210727_changeset_iso8859-1.diff | |
|
39 | 55 | assert_response :success |
|
40 | 56 | assert_template 'diff' |
|
41 | 57 | assert_equal 'text/html', @response.content_type |
|
58 | ||
|
59 | assert_tag 'th', | |
|
60 | :attributes => {:class => /filename/}, | |
|
61 | :content => /issues_controller.rb\t\(rvision 1484\)/ | |
|
62 | assert_tag 'td', | |
|
63 | :attributes => {:class => /line-code/}, | |
|
64 | :content => /Demande cre avec succs/ | |
|
42 | 65 | end |
|
43 | 66 | |
|
44 | 67 | def test_show_text_file |
General Comments 0
You need to be logged in to leave comments.
Login now