do not annotate text files which exceed the size limit for viewing (#9484)

Contributed by Antonio García-Domínguez.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7728 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA
2011-11-05 03:47:03 +00:00
parent ae086b5ef6
commit 4ae7f82f3a
5 changed files with 26 additions and 1 deletions
+10 -1
View File
@@ -172,7 +172,16 @@ class RepositoriesController < ApplicationController
(show_error_not_found; return) unless @entry
@annotate = @repository.scm.annotate(@path, @rev)
(render_error l(:error_scm_annotate); return) if @annotate.nil? || @annotate.empty?
if @annotate.nil? || @annotate.empty?
(render_error l(:error_scm_annotate); return)
end
ann_buf_size = 0
@annotate.lines.each do |buf|
ann_buf_size += buf.size
end
if ann_buf_size > Setting.file_max_size_displayed.to_i.kilobyte
(render_error l(:error_scm_annotate_big_text_file); return)
end
@changeset = @repository.find_changeset_by_name(@rev)
end