From 2fac808343f6809b2d789c433908cd76a77ed2c4 Mon Sep 17 00:00:00 2001 From: Garret Alfert Date: Fri, 5 Jan 2018 06:55:46 +0100 Subject: [PATCH] Split list of ETAGs before removing Weak indicator --- lib/remote_storage/swift.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/remote_storage/swift.rb b/lib/remote_storage/swift.rb index dc2d326..ab4dc1d 100644 --- a/lib/remote_storage/swift.rb +++ b/lib/remote_storage/swift.rb @@ -52,7 +52,9 @@ module RemoteStorage set_response_headers(res) - none_match = (server.env["HTTP_IF_NONE_MATCH"] || "").gsub(/^"?W\//, "").split(",").map(&:strip) + none_match = (server.env["HTTP_IF_NONE_MATCH"] || "").split(",") + .map(&:strip) + .map { |s| s.gsub(/^"?W\//, "") } server.halt 304 if none_match.include? %Q("#{res.headers[:etag]}") return res.body @@ -71,7 +73,9 @@ module RemoteStorage server.headers["Content-Type"] = "application/ld+json" - none_match = (server.env["HTTP_IF_NONE_MATCH"] || "").gsub(/^"?W\//, "").split(",").map(&:strip) + none_match = (server.env["HTTP_IF_NONE_MATCH"] || "").split(",") + .map(&:strip) + .map { |s| s.gsub(/^"?W\//, "") } if etag server.halt 304 if none_match.include? %Q("#{etag}")