diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2012-05-05 01:01:29 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2012-05-05 01:01:29 +0000 |
commit | b0414ec1fbabfa8fa84e69eedcf7617fb969fd82 (patch) | |
tree | 9c3f633024197ef7756a40c584a25d6545944306 /app/controllers | |
parent | 569e1b37cc0893cd8b1015a6d12212b205f0fbdf (diff) | |
download | redmine-b0414ec1fbabfa8fa84e69eedcf7617fb969fd82.tar.gz redmine-b0414ec1fbabfa8fa84e69eedcf7617fb969fd82.zip |
route: scm: split entry and raw actions
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9625 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/repositories_controller.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 1fb708355..d74b59b60 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -152,7 +152,15 @@ class RepositoriesController < ApplicationController end end + def raw + entry_and_raw(true) + end + def entry + entry_and_raw(false) + end + + def entry_and_raw(is_raw) @entry = @repository.entry(@path, @rev) (show_error_not_found; return) unless @entry @@ -161,7 +169,7 @@ class RepositoriesController < ApplicationController @content = @repository.cat(@path, @rev) (show_error_not_found; return) unless @content - if 'raw' == params[:format] || + if is_raw || (@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) || ! is_entry_text_data?(@content, @path) # Force the download @@ -177,6 +185,7 @@ class RepositoriesController < ApplicationController @changeset = @repository.find_changeset_by_name(@rev) end end + private :entry_and_raw def is_entry_text_data?(ent, path) # UTF-16 contains "\x00". |