tool_operate: don't truncate the etag save file by default - #13432
Closed
Gusted wants to merge 1 commit into
Closed
Conversation
This fixes a regression of 75d79a4. The code in tool-operate truncated the etag save file, under the assumption that the file would be written with a new etag value. However since 75d79a4 that might not be the case anymore and could result in the file being truncated when --etag-compare and --etag-save was used and that the etag value matched with what the server responded. Instead the truncation should not be done when a new etag value should be written. Test 3204 was added to verify that the file with the etag value doesn't change the contents when used by --etag-compare and --etage-save and that value matches with what the server returns on a non 2xx response.
bagder
approved these changes
Apr 23, 2024
Member
|
Thanks! |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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 fixes a regression of 75d79a4. The code in tool-operate truncated the etag save file, under the assumption that the file would be written with a new etag value. However since 75d79a4 that might not be the case anymore and could result in the file being truncated when --etag-compare and --etag-save was used and that the etag value matched with what the server responded. Instead the truncation should not be done when a new etag value should be written.
Test 3204 was added to verify that the file with the etag value doesn't change the contents when used by --etag-compare and --etage-save and that value matches with what the server returns on a non 2xx response.
A simple reproducer of this bug is using the command as advertised in the blog post:
Run it three times and notice that for the second time it indeed doesn't download anything but for the third time it does, because on the second time the
etag.txtis being truncated and nothing is being written back.