diff options
author | Johan Sørensen <johan@johansorensen.com> | 2009-03-23 15:58:17 +0100 |
---|---|---|
committer | Johan Sørensen <johan@johansorensen.com> | 2009-04-22 15:17:15 +0200 |
commit | 9197eb52230e4a45ce8ae45e1113e2fc570b48fd (patch) | |
tree | a4f9cfdb9819956176269477e0de5c076a12bbf1 /app/controllers/blobs_controller.rb | |
parent | dc60e934369a3a5f4ab24ed2808a68025ca04e8b (diff) | |
download | gitorious-mainline-outdated-9197eb52230e4a45ce8ae45e1113e2fc570b48fd.zip gitorious-mainline-outdated-9197eb52230e4a45ce8ae45e1113e2fc570b48fd.tar.gz gitorious-mainline-outdated-9197eb52230e4a45ce8ae45e1113e2fc570b48fd.tar.bz2 |
Introduce a stale_conditional? controller helper for not setting conditional GET
headers of there's data in the flash
When used, it prevents a certain amount of foot shooting related incidents
Diffstat (limited to 'app/controllers/blobs_controller.rb')
-rw-r--r-- | app/controllers/blobs_controller.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/controllers/blobs_controller.rb b/app/controllers/blobs_controller.rb index b8d0e56..54cd146 100644 --- a/app/controllers/blobs_controller.rb +++ b/app/controllers/blobs_controller.rb @@ -28,7 +28,8 @@ class BlobsController < ApplicationController redirect_to project_repository_blob_path(@project, @repository, branch_with_tree("HEAD", @path)) and return end - if stale?(:etag => Digest::SHA1.hexdigest(@commit.id + params[:branch_and_path].join), :last_modified => @commit.committed_date.utc) + if stale_conditional?(Digest::SHA1.hexdigest(@commit.id + params[:branch_and_path].join), + @commit.committed_date.utc) @blob = @git.tree(@commit.tree.id, ["#{@path.join("/")}"]).contents.first unless @blob.respond_to?(:data) # it's a tree redirect_to repo_owner_path(@repository, :project_repository_tree_path, |