Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Fix issue 22 'No objects after restart of fakes3' #69

Closed
wants to merge 1 commit into from
Closed

Fix issue 22 'No objects after restart of fakes3' #69

wants to merge 1 commit into from

Conversation

mark2997
Copy link

See #22
This is the fix from dterhorst from 25 Jan 2014. The fix worked well for me on Fedora 20

See #22
This is the fix from dterhorst from 25 Jan 2014. The fix worked well for me on Fedora 20
@Allactaga
Copy link

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

@mark2997
Copy link
Author

mark2997 commented May 3, 2015

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)

@SimonKenyonShepard
Copy link

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....

eikevons pushed a commit to eikevons/fake-s3 that referenced this pull request Aug 26, 2015
saltzmanjoelh pushed a commit to saltzmanjoelh/fake-s3 that referenced this pull request Sep 14, 2016
@ganeshgore
Copy link

Why this changes are not merged ??
Or is there any alternate solution to get back all keys after restart

@mark2997 mark2997 closed this by deleting the head repository Nov 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants