@@ -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 | end |
|
29 | end | |
30 |
|
30 | |||
31 | def to_utf8(str) |
|
31 | def to_utf8(str) | |
32 | 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 | |||
|
37 | str | |||
|
38 | end | |||
33 | end |
|
39 | end | |
34 | end |
|
40 | end |
@@ -4,7 +4,7 | |||||
4 | <% if diff_type == 'sbs' -%> |
|
4 | <% if diff_type == 'sbs' -%> | |
5 | <table class="filecontent"> |
|
5 | <table class="filecontent"> | |
6 | <thead> |
|
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 | </thead> |
|
8 | </thead> | |
9 | <tbody> |
|
9 | <tbody> | |
10 | <% prev_line_left, prev_line_right = nil, nil -%> |
|
10 | <% prev_line_left, prev_line_right = nil, nil -%> | |
@@ -31,7 +31,7 | |||||
31 | <% else -%> |
|
31 | <% else -%> | |
32 | <table class="filecontent syntaxhl"> |
|
32 | <table class="filecontent syntaxhl"> | |
33 | <thead> |
|
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 | </thead> |
|
35 | </thead> | |
36 | <tbody> |
|
36 | <tbody> | |
37 | <% prev_line_left, prev_line_right = nil, nil -%> |
|
37 | <% prev_line_left, prev_line_right = nil, nil -%> |
@@ -54,11 +54,11 attachments_005: | |||||
54 | container_type: Issue |
|
54 | container_type: Issue | |
55 | container_id: 3 |
|
55 | container_id: 3 | |
56 | downloads: 0 |
|
56 | downloads: 0 | |
57 | disk_filename: 060719210727_changeset.diff |
|
57 | disk_filename: 060719210727_changeset_iso8859-1.diff | |
58 | digest: b91e08d0cf966d5c6ff411bd8c4cc3a2 |
|
58 | digest: b91e08d0cf966d5c6ff411bd8c4cc3a2 | |
59 | id: 5 |
|
59 | id: 5 | |
60 | filesize: 687 |
|
60 | filesize: 687 | |
61 | filename: changeset.diff |
|
61 | filename: changeset_iso8859-1.diff | |
62 | author_id: 2 |
|
62 | author_id: 2 | |
63 | content_type: text/x-diff |
|
63 | content_type: text/x-diff | |
64 | attachments_006: |
|
64 | attachments_006: | |
@@ -157,3 +157,15 attachments_013: | |||||
157 | filename: foo.zip |
|
157 | filename: foo.zip | |
158 | author_id: 2 |
|
158 | author_id: 2 | |
159 | content_type: application/octet-stream |
|
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 | Index: trunk/app/controllers/issues_controller.rb |
|
1 | Index: trunk/app/controllers/issues_controller.rb | |
2 | =================================================================== |
|
2 | =================================================================== | |
3 | --- trunk/app/controllers/issues_controller.rb (r�vision 1483) |
|
3 | --- trunk/app/controllers/issues_controller.rb (r�vision 1483) | |
4 | +++ trunk/app/controllers/issues_controller.rb (r�vision 1484) |
|
4 | +++ trunk/app/controllers/issues_controller.rb (r�vision 1484) | |
5 | @@ -149,7 +149,7 @@ |
|
5 | @@ -149,7 +149,7 @@ | |
6 | attach_files(@issue, params[:attachments]) |
|
6 | attach_files(@issue, params[:attachments]) | |
7 |
flash[:notice] = |
|
7 | flash[:notice] = 'Demande cr��e avec succ�s' | |
8 | Mailer.deliver_issue_add(@issue) if Setting.notified_events.include?('issue_added') |
|
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 |
|
9 | - redirect_to :controller => 'issues', :action => 'show', :id => @issue, :project_id => @project | |
10 | + redirect_to :controller => 'issues', :action => 'show', :id => @issue |
|
10 | + redirect_to :controller => 'issues', :action => 'show', :id => @issue |
@@ -1,5 +1,7 | |||||
1 | # redMine - project management software |
|
1 | # encoding: utf-8 | |
2 | # Copyright (C) 2006-2008 Jean-Philippe Lang |
|
2 | # | |
|
3 | # Redmine - project management software | |||
|
4 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |||
3 | # |
|
5 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
6 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
7 | # modify it under the terms of the GNU General Public License | |
@@ -35,10 +37,31 class AttachmentsControllerTest < ActionController::TestCase | |||||
35 | end |
|
37 | end | |
36 |
|
38 | |||
37 | def test_show_diff |
|
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 | assert_response :success |
|
55 | assert_response :success | |
40 | assert_template 'diff' |
|
56 | assert_template 'diff' | |
41 | assert_equal 'text/html', @response.content_type |
|
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 | end |
|
65 | end | |
43 |
|
66 | |||
44 | def test_show_text_file |
|
67 | def test_show_text_file |
General Comments 0
You need to be logged in to leave comments.
Login now