comparison 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
comparison
equal deleted inserted replaced
1115:433d4f72a19b 1116:bb32da3bea34
61 61
62 def edit 62 def edit
63 end 63 end
64 64
65 def update 65 def update
66 params[:repository_scm]='Mercurial'
66 attrs = pickup_extra_info 67 attrs = pickup_extra_info
67 @repository.safe_attributes = attrs[:attrs] 68 @repository.safe_attributes = attrs[:attrs]
68 if attrs[:attrs_extra].keys.any? 69 if attrs[:attrs_extra].keys.any?
69 @repository.merge_extra_info(attrs[:attrs_extra]) 70 @repository.merge_extra_info(attrs[:attrs_extra])
70 end 71 end
167 # If the entry is a dir, show the browser 168 # If the entry is a dir, show the browser
168 (show; return) if @entry.is_dir? 169 (show; return) if @entry.is_dir?
169 170
170 @content = @repository.cat(@path, @rev) 171 @content = @repository.cat(@path, @rev)
171 (show_error_not_found; return) unless @content 172 (show_error_not_found; return) unless @content
172 if is_raw || 173 if is_raw
173 (@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) ||
174 ! is_entry_text_data?(@content, @path)
175 # Force the download 174 # Force the download
176 send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) } 175 send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) }
177 send_type = Redmine::MimeType.of(@path) 176 send_type = Redmine::MimeType.of(@path)
178 send_opt[:type] = send_type.to_s if send_type 177 send_opt[:type] = send_type.to_s if send_type
179 send_opt[:disposition] = (Redmine::MimeType.is_type?('image', @path) && !is_raw ? 'inline' : 'attachment') 178 send_opt[:disposition] = (Redmine::MimeType.is_type?('image', @path) && !is_raw ? 'inline' : 'attachment')
180 send_data @content, send_opt 179 send_data @content, send_opt
181 else 180 else
181 @display_raw = ((@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) || !is_entry_text_data?(@content, @path))
182 # Prevent empty lines when displaying a file with Windows style eol 182 # Prevent empty lines when displaying a file with Windows style eol
183 # TODO: UTF-16 183 # TODO: UTF-16
184 # Is this needs? AttachmentsController reads file simply. 184 # Is this needs? AttachmentsController reads file simply.
185 @content.gsub!("\r\n", "\n") 185 @content.gsub!("\r\n", "\n")
186 @changeset = @repository.find_changeset_by_name(@rev) 186 @changeset = @repository.find_changeset_by_name(@rev)