diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index 83e26ac..9ba6cce 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -171,9 +171,15 @@ class RepositoriesController < ApplicationController
     @entry = @repository.entry(@path, @rev)
     (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?
-    @changeset = @repository.find_changeset_by_name(@rev)
+    @content = @repository.cat(@path, @rev)
+    (show_error_not_found; return) unless @content
+    if is_entry_text_data?(@content, @path) && @content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte
+      render_error :message => l(:error_scm_annotate_big_text_file)
+    else
+      @annotate = @repository.scm.annotate(@path, @rev)
+      (render_error l(:error_scm_annotate); return) if @annotate.nil? || @annotate.empty?
+      @changeset = @repository.find_changeset_by_name(@rev)
+    end
   end
 
   def revision
diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml
index 4865f6a..5b09030 100644
--- a/config/locales/en-GB.yml
+++ b/config/locales/en-GB.yml
@@ -180,6 +180,7 @@ en-GB:
   error_scm_not_found: "The entry or revision was not found in the repository."
   error_scm_command_failed: "An error occurred when trying to access the repository: %{value}"
   error_scm_annotate: "The entry does not exist or cannot be annotated."
+  error_scm_annotate_big_text_file: "The entry cannot be annotated, as it exceeds the maximum text file size."
   error_issue_not_found_in_project: 'The issue was not found or does not belong to this project'
   error_no_tracker_in_project: 'No tracker is associated to this project. Please check the Project settings.'
   error_no_default_issue_status: 'No default issue status is defined. Please check your configuration (Go to "Administration -> Issue statuses").'
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 8a792d4..b828b0c 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -176,6 +176,7 @@ en:
   error_scm_not_found: "The entry or revision was not found in the repository."
   error_scm_command_failed: "An error occurred when trying to access the repository: %{value}"
   error_scm_annotate: "The entry does not exist or cannot be annotated."
+  error_scm_annotate_big_text_file: "The entry cannot be annotated, as it exceeds the maximum text file size."
   error_issue_not_found_in_project: 'The issue was not found or does not belong to this project'
   error_no_tracker_in_project: 'No tracker is associated to this project. Please check the Project settings.'
   error_no_default_issue_status: 'No default issue status is defined. Please check your configuration (Go to "Administration -> Issue statuses").'
diff --git a/config/locales/es.yml b/config/locales/es.yml
index 81d46b7..1b6443b 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -245,6 +245,7 @@ es:
   error_can_t_load_default_data: "No se ha podido cargar la configuración por defecto: %{value}"
   error_issue_not_found_in_project: 'La petición no se encuentra o no está asociada a este proyecto'
   error_scm_annotate: "No existe la entrada o no ha podido ser anotada"
+  error_scm_annotate_big_text_file: "La entrada no puede anotarse, al superar el tamaño máximo para ficheros de texto."
   error_scm_command_failed: "Se produjo un error al acceder al repositorio: %{value}"
   error_scm_not_found: "La entrada y/o la revisión no existe en el repositorio."
   field_account: Cuenta
diff --git a/test/functional/repositories_subversion_controller_test.rb b/test/functional/repositories_subversion_controller_test.rb
index ba6c6bf..2dd3ccd 100644
--- a/test/functional/repositories_subversion_controller_test.rb
+++ b/test/functional/repositories_subversion_controller_test.rb
@@ -334,6 +334,20 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase
       assert_tag :tag => 'h2', :content => /@ 8/
     end
 
+    def test_annotate_error_when_too_big
+      assert_equal 0, @repository.changesets.count
+      @repository.fetch_changesets
+      @project.reload
+      assert_equal NUM_REV, @repository.changesets.count
+      # no files in the test repo is larger than 1KB...
+      with_settings :file_max_size_displayed => 0 do
+        get :annotate, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c']
+        assert_response 500
+        assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
+                                :content => /exceeds the maximum text file size/
+      end
+    end
+
     def test_destroy_valid_repository
       @request.session[:user_id] = 1 # admin
       assert_equal 0, @repository.changesets.count
