diff app/controllers/repositories_controller.rb @ 1116:bb32da3bea34 redmine-2.2-integration

Merge from live
author Chris Cannam
date Mon, 07 Jan 2013 14:41:20 +0000
parents 433d4f72a19b 997f6d7738f7
children 4f746d8966dd fc0fecf09eb9
line wrap: on
line diff
--- a/app/controllers/repositories_controller.rb	Mon Jan 07 12:01:42 2013 +0000
+++ b/app/controllers/repositories_controller.rb	Mon Jan 07 14:41:20 2013 +0000
@@ -63,6 +63,7 @@
   end
 
   def update
+    params[:repository_scm]='Mercurial'
     attrs = pickup_extra_info
     @repository.safe_attributes = attrs[:attrs]
     if attrs[:attrs_extra].keys.any?
@@ -169,9 +170,7 @@
 
     @content = @repository.cat(@path, @rev)
     (show_error_not_found; return) unless @content
-    if is_raw ||
-         (@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) ||
-         ! is_entry_text_data?(@content, @path)
+    if is_raw
       # Force the download
       send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) }
       send_type = Redmine::MimeType.of(@path)
@@ -179,6 +178,7 @@
       send_opt[:disposition] = (Redmine::MimeType.is_type?('image', @path) && !is_raw ? 'inline' : 'attachment')
       send_data @content, send_opt
     else
+      @display_raw = ((@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) || !is_entry_text_data?(@content, @path))
       # Prevent empty lines when displaying a file with Windows style eol
       # TODO: UTF-16
       # Is this needs? AttachmentsController reads file simply.