diff options
author | Johan Sørensen <johan@johansorensen.com> | 2009-06-11 13:32:48 +0200 |
---|---|---|
committer | Johan Sørensen <johan@johansorensen.com> | 2009-06-11 13:41:27 +0200 |
commit | 193d8d984c07bd45d24be1d6c67ed200aa11faa8 (patch) | |
tree | ce6a7ee3a66189af8fa5625ed14b2265e0889d73 /app/controllers/blobs_controller.rb | |
parent | 16345634b67935851453b0d87332a003a24c1c75 (diff) | |
download | gitorious-mainline-outdated-193d8d984c07bd45d24be1d6c67ed200aa11faa8.zip gitorious-mainline-outdated-193d8d984c07bd45d24be1d6c67ed200aa11faa8.tar.gz gitorious-mainline-outdated-193d8d984c07bd45d24be1d6c67ed200aa11faa8.tar.bz2 |
Better binary blob detection
Just check the first 1024 bytes if there's any null bytes, instead of using
the error prone mime-type detection, which gives us a smaller chance of
false-positives with the null byte detection
Diffstat (limited to 'app/controllers/blobs_controller.rb')
-rw-r--r-- | app/controllers/blobs_controller.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/blobs_controller.rb b/app/controllers/blobs_controller.rb index 4766d0d..c2240c1 100644 --- a/app/controllers/blobs_controller.rb +++ b/app/controllers/blobs_controller.rb @@ -58,7 +58,7 @@ class BlobsController < ApplicationController @blob = @git.tree(@commit.tree.id, ["#{@path.join("/")}"]).contents.first render_not_found and return unless @blob if @blob.size > 500.kilobytes - flash[:error] = I18n.t "blogs_controller.raw_error" + flash[:error] = I18n.t "blobs_controller.raw_error", :size => @blob.size redirect_to project_repository_path(@project, @repository) and return end expires_in 30.minutes |