fake-s3
fake-s3 copied to clipboard
Fix issue 22 'No objects after restart of fakes3'
See https://github.com/jubos/fake-s3/issues/22 This is the fix from dterhorst from 25 Jan 2014. The fix worked well for me on Fedora 20
Hi, @mark2997, i think this solution only get objects that are stored in the root folder. I have to adapt it like this to make it working for the nested folders:
private
def get_objects bucket_name, path, root_path=nil
if root_path.nil?
root_path = path
end
objects = []
Dir.new(path).each do |pathname|
next if ['.', '..'].include?(pathname)
if pathname == SHUCK_METADATA_DIR
objects << get_object(bucket_name, path[root_path.length..-1], nil)
else
objects += get_objects(bucket_name, File.join(path, pathname), root_path)
end
end
return objects
end
end
Allactaga - This almost worked for me - I found that it restored the objects with an extra slash at the start of the key (on Linux). There was an out-by-one error and I had to change the following line:
objects << get_object(bucket_name, path[root_path.length..-1], nil)
to this:
objects << get_object(bucket_name, path[root_path.length+1..-1], nil)
Hey, I would really like this patch to be included in the master branch! Desperately need the ability to restart the server without loosing all uploaded items on my project....
Why this changes are not merged ?? Or is there any alternate solution to get back all keys after restart