Mercurial > hg > soundsoftware-site
comparison app/controllers/repositories_controller.rb @ 1084:3b7e11eaf1ca cannam
Merge from branch "bug_531"
author | Chris Cannam |
---|---|
date | Fri, 23 Nov 2012 13:34:20 +0000 |
parents | 997f6d7738f7 |
children | bb32da3bea34 |
comparison
equal
deleted
inserted
replaced
1076:b665182d9dd9 | 1084:3b7e11eaf1ca |
---|---|
141 # If the entry is a dir, show the browser | 141 # If the entry is a dir, show the browser |
142 (show; return) if @entry.is_dir? | 142 (show; return) if @entry.is_dir? |
143 | 143 |
144 @content = @repository.cat(@path, @rev) | 144 @content = @repository.cat(@path, @rev) |
145 (show_error_not_found; return) unless @content | 145 (show_error_not_found; return) unless @content |
146 if 'raw' == params[:format] || | 146 if 'raw' == params[:format] |
147 (@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) || | |
148 ! is_entry_text_data?(@content, @path) | |
149 # Force the download | 147 # Force the download |
150 send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) } | 148 send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) } |
151 send_type = Redmine::MimeType.of(@path) | 149 send_type = Redmine::MimeType.of(@path) |
152 send_opt[:type] = send_type.to_s if send_type | 150 send_opt[:type] = send_type.to_s if send_type |
153 send_data @content, send_opt | 151 send_data @content, send_opt |
154 else | 152 else |
153 @display_raw = ((@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) || !is_entry_text_data?(@content, @path)) | |
155 # Prevent empty lines when displaying a file with Windows style eol | 154 # Prevent empty lines when displaying a file with Windows style eol |
156 # TODO: UTF-16 | 155 # TODO: UTF-16 |
157 # Is this needs? AttachmentsController reads file simply. | 156 # Is this needs? AttachmentsController reads file simply. |
158 @content.gsub!("\r\n", "\n") | 157 @content.gsub!("\r\n", "\n") |
159 @changeset = @repository.find_changeset_by_name(@rev) | 158 @changeset = @repository.find_changeset_by_name(@rev) |