This repository was archived by the owner on Feb 12, 2021. It is now read-only.
Download with deleteRemoved option should not delete subdirectory#57
Open
brzpegasus wants to merge 1 commit intoandrewrk:masterfrom
Open
Download with deleteRemoved option should not delete subdirectory#57brzpegasus wants to merge 1 commit intoandrewrk:masterfrom
brzpegasus wants to merge 1 commit intoandrewrk:masterfrom
Conversation
enabled. * allS3Objects should not contain the directory specified by 'prefix'. Fixes andrewrk#54
Owner
|
Thank you for doing this investigation and fix. This is a big deal. I want to take the proper time to fully understand the explanation that you gave here before merging, and I will try to do that before the end of the day. |
Owner
|
I'd like to see if I can add a test case to cover this too, since it's such a tricky case. |
Author
|
Sounds good! |
Contributor
|
As andrew said, this needs a test. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #54
To sum it up, when you try to download a remote directory called
remote-dirfrom a bucket, and specify the local directory aslocal-dir, I would expect just the contents ofremote-dirto download, not the directory itself, soremote-dir/shouldn't need to be pushed toallS3Objectswhen listing remote objects, but it is right now.If
local-dirhas a subdirectory calledfoo(valid directory that also exists remotely and thus should be retained), it will get deleted on the next download attempt. Because of the extraremote-dir/entry inallS3Objects, when you start diff'ing the remote objects against the local ones, you end up checking if the stringfoo/is contained within theremote-dir/s3Object.key string, which is an empty string after the prefix truncation. And since it isn't,deleteLocalDir()gets called.