Trim double quotes from received ETag when checking hashes #175
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.
This issue was originally discussing over at the rclone forums:
https://forum.rclone.org/t/intended-behavior-of-sync-and-checksum-for-swift/26743
For Swift servers/accounts/containers that are configured to use RFC-compliant ETags enclosed in double quotes[1][2], rclone was mistakenly considering objects corrupted when comparing
"<hash>"
vs<hash>
.This could happen for operations such as
sync
(both ways), typically during transfer (ETag
in response toPUT
request`), or possibly triggering retransfers when object already present at destination (comparing object checksum in JSON formatted container listing vs. header ETag).I have tested my patch on Swift v2.25.1 together with rclone v1.56.2 on Go 1.17.1.
This is my first time playing around with Go so if there's anything that needs to be addressed please let me know :-)
[1] https://github.com/openstack/swift/blob/2.24.0/CHANGELOG#L9
[2] https://datatracker.ietf.org/doc/html/rfc7232#section-2.3