-
-
Notifications
You must be signed in to change notification settings - Fork 203
Fix sync prefix bug #473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix sync prefix bug #473
Conversation
|
@mlilius While I haven't look in depth into this pull request and what it is solving. There are a few things that need to happen with this PR.
Additionally, please provide a working example that allows us to easily replicate the issue. Thanks! |
9e20587 to
66d5e3d
Compare
…second+ files to have duplicated prefixes added to the objects fullname_with_prefix. The merged prefix was put together backwards. The merged prefix needs to be object_prefix+prefix.
66d5e3d to
cd79794
Compare
|
Here are the steps to test the before and after. Just replace USERNAME, API_KEY, and THECONTAINER Results before the patchResults after the patch |
|
@mlilius I've done a little testing, and with the change in this PR, the I've tested a fix which prevents continually resetting the prefix that is used with Would you mind testing the following code? diff --git a/pyrax/object_storage.py b/pyrax/object_storage.py
index 5565600..9e6a55d 100644
--- a/pyrax/object_storage.py
+++ b/pyrax/object_storage.py
@@ -3087,7 +3085,7 @@ class StorageClient(BaseClient):
if os.path.isdir(pth):
subprefix = fname
if prefix:
- subprefix = "%s/%s" % (prefix, subprefix)
+ subprefix = os.path.join(prefix, subprefix)
self._sync_folder_to_container(pth, container, prefix=subprefix,
delete=delete, include_hidden=include_hidden,
ignore=ignore, ignore_timestamps=ignore_timestamps,
@@ -3097,7 +3095,8 @@ class StorageClient(BaseClient):
fname))
local_etag = utils.get_checksum(pth)
if object_prefix:
- prefix = os.path.join(prefix, object_prefix)
+ prefix = os.path.join(object_prefix, prefix)
+ object_prefix = ""
fullname_with_prefix = os.path.join(prefix, fname)
try:
obj = self._remote_files[fullname_with_prefix] |
|
Closing in favor of #498 |
When doing a sync the second file and all the others after that will have the prefix doubled up. I changed it to use a separate variable while in the loop.