From 4ae7f82f3ae13ff01d1581f2a8f271ff294e06be Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sat, 5 Nov 2011 03:47:03 +0000 Subject: do not annotate text files which exceed the size limit for viewing (#9484) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contributed by Antonio García-Domínguez. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7728 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/repositories_controller.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'app') 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 -- cgit v1.2.3