From 8ad882d5ab9dce2dbc241f5e31db43b2c3e8336b Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Thu, 1 Sep 2016 18:12:52 +0200 Subject: [PATCH] If user container doesn't exist, use shared container --- lib/remote_storage/swift.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/remote_storage/swift.rb b/lib/remote_storage/swift.rb index 3c5bb12..fa84347 100644 --- a/lib/remote_storage/swift.rb +++ b/lib/remote_storage/swift.rb @@ -383,7 +383,13 @@ module RemoteStorage end def container_url_for(user) - "#{base_url}/#{container_for(user)}" + user_container_url = "#{base_url}/#{container_for(user)}" + res = do_head_request(user_container_url) + # User before container migration + return user_container_url if res.status == 200 + rescue RestClient::ResourceNotFound + # User after container migration + "#{base_url}/rs:documents:#{settings.environment.to_s}/#{user}" end def url_for_key(user, directory, key)