@@ -172,7 +172,16 class RepositoriesController < ApplicationController | |||
|
172 | 172 | (show_error_not_found; return) unless @entry |
|
173 | 173 | |
|
174 | 174 | @annotate = @repository.scm.annotate(@path, @rev) |
|
175 |
|
|
|
175 | if @annotate.nil? || @annotate.empty? | |
|
176 | (render_error l(:error_scm_annotate); return) | |
|
177 | end | |
|
178 | ann_buf_size = 0 | |
|
179 | @annotate.lines.each do |buf| | |
|
180 | ann_buf_size += buf.size | |
|
181 | end | |
|
182 | if ann_buf_size > Setting.file_max_size_displayed.to_i.kilobyte | |
|
183 | (render_error l(:error_scm_annotate_big_text_file); return) | |
|
184 | end | |
|
176 | 185 | @changeset = @repository.find_changeset_by_name(@rev) |
|
177 | 186 | end |
|
178 | 187 |
@@ -180,6 +180,7 en-GB: | |||
|
180 | 180 | error_scm_not_found: "The entry or revision was not found in the repository." |
|
181 | 181 | error_scm_command_failed: "An error occurred when trying to access the repository: %{value}" |
|
182 | 182 | error_scm_annotate: "The entry does not exist or cannot be annotated." |
|
183 | error_scm_annotate_big_text_file: "The entry cannot be annotated, as it exceeds the maximum text file size." | |
|
183 | 184 | error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' |
|
184 | 185 | error_no_tracker_in_project: 'No tracker is associated to this project. Please check the Project settings.' |
|
185 | 186 | error_no_default_issue_status: 'No default issue status is defined. Please check your configuration (Go to "Administration -> Issue statuses").' |
@@ -176,6 +176,7 en: | |||
|
176 | 176 | error_scm_not_found: "The entry or revision was not found in the repository." |
|
177 | 177 | error_scm_command_failed: "An error occurred when trying to access the repository: %{value}" |
|
178 | 178 | error_scm_annotate: "The entry does not exist or cannot be annotated." |
|
179 | error_scm_annotate_big_text_file: "The entry cannot be annotated, as it exceeds the maximum text file size." | |
|
179 | 180 | error_issue_not_found_in_project: 'The issue was not found or does not belong to this project' |
|
180 | 181 | error_no_tracker_in_project: 'No tracker is associated to this project. Please check the Project settings.' |
|
181 | 182 | error_no_default_issue_status: 'No default issue status is defined. Please check your configuration (Go to "Administration -> Issue statuses").' |
@@ -245,6 +245,7 es: | |||
|
245 | 245 | error_can_t_load_default_data: "No se ha podido cargar la configuración por defecto: %{value}" |
|
246 | 246 | error_issue_not_found_in_project: 'La petición no se encuentra o no está asociada a este proyecto' |
|
247 | 247 | error_scm_annotate: "No existe la entrada o no ha podido ser anotada" |
|
248 | error_scm_annotate_big_text_file: "La entrada no puede anotarse, al superar el tamaño máximo para ficheros de texto." | |
|
248 | 249 | error_scm_command_failed: "Se produjo un error al acceder al repositorio: %{value}" |
|
249 | 250 | error_scm_not_found: "La entrada y/o la revisión no existe en el repositorio." |
|
250 | 251 | field_account: Cuenta |
@@ -354,6 +354,19 class RepositoriesGitControllerTest < ActionController::TestCase | |||
|
354 | 354 | :content => /cannot be annotated/ |
|
355 | 355 | end |
|
356 | 356 | |
|
357 | def test_annotate_error_when_too_big | |
|
358 | with_settings :file_max_size_displayed => 1 do | |
|
359 | get :annotate, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'], :rev => 'deff712f' | |
|
360 | assert_response 500 | |
|
361 | assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ }, | |
|
362 | :content => /exceeds the maximum text file size/ | |
|
363 | ||
|
364 | get :annotate, :id => PRJ_ID, :path => ['README'], :rev => '7234cb2' | |
|
365 | assert_response :success | |
|
366 | assert_template 'annotate' | |
|
367 | end | |
|
368 | end | |
|
369 | ||
|
357 | 370 | def test_annotate_latin_1 |
|
358 | 371 | if @ruby19_non_utf8_pass |
|
359 | 372 | puts_ruby19_non_utf8_pass() |
General Comments 0
You need to be logged in to leave comments.
Login now