diff options
author | Tim Burke <tim.burke@gmail.com> | 2019-04-10 16:22:27 -0700 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2019-06-27 21:45:10 -0700 |
commit | 9021a58c240e156f54ffafdc4609868f348d3ebc (patch) | |
tree | 0ab82d4b2aa595a99cf8d48695a3724f47f3f589 /swiftclient/utils.py | |
parent | 113eacf3b80f61d366b3e95b558b40f82ff728a4 (diff) | |
download | python-swiftclient-9021a58c240e156f54ffafdc4609868f348d3ebc.tar.gz |
Fix SLO re-upload
Previously, if you uploaded a file as an SLO then re-uploaded it
with the same segment size and mtime, the second upload would
go delete the segments it just (re)uploaded. This was due to
us tracking old_slo_manifest_paths and new_slo_manifest_paths
in different formats; one would have a leading slash while the
other would not.
Now, normalize to the stripped-slash version so we stop deleting
segments we just uploaded.
Change-Id: Ibcbed3df4febe81cdf13855656e2daaca8d521b4
Diffstat (limited to 'swiftclient/utils.py')
-rw-r--r-- | swiftclient/utils.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/swiftclient/utils.py b/swiftclient/utils.py index 87a4390..2b208b9 100644 --- a/swiftclient/utils.py +++ b/swiftclient/utils.py @@ -395,3 +395,11 @@ def n_at_a_time(seq, n): def n_groups(seq, n): items_per_group = ((len(seq) - 1) // n) + 1 return n_at_a_time(seq, items_per_group) + + +def normalize_manifest_path(path): + if six.PY2 and isinstance(path, six.text_type): + path = path.encode('utf-8') + if path.startswith('/'): + return path[1:] + return path |