summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-11-05 03:47:03 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-11-05 03:47:03 +0000
commit4ae7f82f3ae13ff01d1581f2a8f271ff294e06be (patch)
tree68df52c8c116441c0fa7e7bc9c5c4a1a582480da /app
parentae086b5ef60fd0b71a144e542b70acfa4644527a (diff)
downloadredmine-4ae7f82f3ae13ff01d1581f2a8f271ff294e06be.tar.gz
redmine-4ae7f82f3ae13ff01d1581f2a8f271ff294e06be.zip
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
Diffstat (limited to 'app')
-rw-r--r--app/controllers/repositories_controller.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index a04498af0..7f346bfd6 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -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