From aed1cd3c1777f039de94cb2286474886a49924a1 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Wed, 4 Sep 2013 16:42:20 -0400 Subject: [PATCH] Add patch to fix GET Bucket requests to fake-s3 See https://github.com/jubos/fake-s3/pull/37 Signed-off-by: Shea Levy --- .../development/interpreters/ruby/patches.nix | 7 +++++ .../ruby-modules/fake-s3-list-bucket.patch | 30 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 pkgs/development/ruby-modules/fake-s3-list-bucket.patch diff --git a/pkgs/development/interpreters/ruby/patches.nix b/pkgs/development/interpreters/ruby/patches.nix index 2ac65dbb7e10..7c80cdfe0653 100644 --- a/pkgs/development/interpreters/ruby/patches.nix +++ b/pkgs/development/interpreters/ruby/patches.nix @@ -117,4 +117,11 @@ in }; pry = { gemFlags = "--no-ri --no-rdoc"; }; + + fakes3 = { + postInstall = '' + cd $out/${ruby.gemPath}/gems/* + patch -Np1 -i ${../../ruby-modules/fake-s3-list-bucket.patch} + ''; + }; } diff --git a/pkgs/development/ruby-modules/fake-s3-list-bucket.patch b/pkgs/development/ruby-modules/fake-s3-list-bucket.patch new file mode 100644 index 000000000000..251935161d18 --- /dev/null +++ b/pkgs/development/ruby-modules/fake-s3-list-bucket.patch @@ -0,0 +1,30 @@ +commit 983634ea6b81910529596c262644eacfa2c2c4f9 +Author: Shea Levy +Date: Wed Sep 4 16:16:12 2013 -0400 + + Fix LS_BUCKET + + GET foo.s3.amazonaws.com/ and GET s3.amazonaws.com/foo should result in + an LS_BUCKET request, but under the previous logic it would result in a + LIST_BUCKETS request. GET s3.amazonaws.com/ still results in a + LIST_BUCKETS request due to the 'if path == "/" and s_req.is_path_style' + conditional. + + Signed-off-by: Shea Levy + +diff --git a/lib/fakes3/server.rb b/lib/fakes3/server.rb +index 6958151..36d9cad 100644 +--- a/lib/fakes3/server.rb ++++ b/lib/fakes3/server.rb +@@ -213,10 +213,7 @@ module FakeS3 + elems = path.split("/") + end + +- if elems.size == 0 +- # List buckets +- s_req.type = Request::LIST_BUCKETS +- elsif elems.size == 1 ++ if elems.size < 2 + s_req.type = Request::LS_BUCKET + s_req.query = query + else