diff app/controllers/.svn/text-base/repositories_controller.rb.svn-base @ 245:051f544170fe

* Update to SVN trunk revision 4993
author Chris Cannam
date Thu, 03 Mar 2011 11:42:28 +0000
parents 0579821a129a
children eeebe205a056 cbce1fd3b1b7
line wrap: on
line diff
--- a/app/controllers/.svn/text-base/repositories_controller.rb.svn-base	Thu Mar 03 11:40:10 2011 +0000
+++ b/app/controllers/.svn/text-base/repositories_controller.rb.svn-base	Thu Mar 03 11:42:28 2011 +0000
@@ -67,13 +67,13 @@
       redirect_to :action => 'committers', :id => @project
     end
   end
-  
+
   def destroy
     @repository.destroy
     redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'repository'
   end
-  
-  def show 
+
+  def show
     @repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty?
 
     @entries = @repository.entries(@path, @rev)
@@ -88,7 +88,7 @@
   end
 
   alias_method :browse, :show
-  
+
   def changes
     @entry = @repository.entry(@path, @rev)
     (show_error_not_found; return) unless @entry
@@ -96,23 +96,23 @@
     @properties = @repository.properties(@path, @rev)
     @changeset = @repository.find_changeset_by_name(@rev)
   end
-  
+
   def revisions
     @changeset_count = @repository.changesets.count
     @changeset_pages = Paginator.new self, @changeset_count,
-								      per_page_option,
-								      params['page']								
+                                     per_page_option,
+                                     params['page']
     @changesets = @repository.changesets.find(:all,
-						:limit  =>  @changeset_pages.items_per_page,
-						:offset =>  @changeset_pages.current.offset,
-            :include => [:user, :repository])
+                       :limit  =>  @changeset_pages.items_per_page,
+                       :offset =>  @changeset_pages.current.offset,
+                       :include => [:user, :repository])
 
     respond_to do |format|
       format.html { render :layout => false if request.xhr? }
       format.atom { render_feed(@changesets, :title => "#{@project.name}: #{l(:label_revision_plural)}") }
     end
   end
-  
+
   def entry
     @entry = @repository.entry(@path, @rev)
     (show_error_not_found; return) unless @entry
@@ -122,9 +122,10 @@
 
     @content = @repository.cat(@path, @rev)
     (show_error_not_found; return) unless @content
-    if 'raw' == params[:format] || @content.is_binary_data? || (@entry.size && @entry.size > Setting.file_max_size_displayed.to_i.kilobyte)
+    if 'raw' == params[:format] || @content.is_binary_data? ||
+         (@entry.size && @entry.size > Setting.file_max_size_displayed.to_i.kilobyte)
       # Force the download
-      send_data @content, :filename => @path.split('/').last
+      send_data @content, :filename => filename_for_content_disposition(@path.split('/').last)
     else
       # Prevent empty lines when displaying a file with Windows style eol
       @content.gsub!("\r\n", "\n")
@@ -135,7 +136,7 @@
   def annotate
     @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)
@@ -153,7 +154,7 @@
   rescue ChangesetNotFound
     show_error_not_found
   end
-  
+
   def diff
     if params[:format] == 'diff'
       @diff = @repository.diff(@path, @rev, @rev_to)
@@ -185,11 +186,11 @@
     end
   end
 
-  def stats  
+  def stats
   end
-  
+
   def graph
-    data = nil    
+    data = nil
     case params[:graph]
     when "commits_per_month"
       data = graph_commits_per_month(@repository)
@@ -217,7 +218,7 @@
     @rev = params[:rev].blank? ? @repository.default_branch : params[:rev].strip
     @rev_to = params[:rev_to]
     
-    unless @rev.to_s.match(REV_PARAM_RE) && @rev.to_s.match(REV_PARAM_RE)
+    unless @rev.to_s.match(REV_PARAM_RE) && @rev_to.to_s.match(REV_PARAM_RE)
       if @repository.branches.blank?
         raise InvalidRevisionParam
       end