Closed pomegranited closed 6 years ago
Merging #100 into master will increase coverage by
0.02%
. The diff coverage is100%
.
@@ Coverage Diff @@
## master #100 +/- ##
==========================================
+ Coverage 97.89% 97.92% +0.02%
==========================================
Files 1 1
Lines 238 241 +3
==========================================
+ Hits 233 236 +3
Misses 5 5
Impacted Files | Coverage Δ | |
---|---|---|
swift/storage.py | 97.92% <100%> (+0.02%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 27d34cf...4d560fb. Read the comment docs.
Another option would be to track who is doing .write() and make that method update the .size attribute too, to keep it correct. Then we could always send it. But it would involve changing every possible user. Because sending the content length isn't required by SWIFT, better not to send it.
With that documentation, :+1:
Hi @dennisv @einarf -- would you be willing to review this PR? Thank you!
Thank you @dennisv ! Could we also get 1.2.19 pushed to pypi?
Adds
SWIFT_CONTENT_LENGTH_FROM_FD
with defaultTrue
, which preserves the current behaviour by inferring thecontent_length
header from the Django File object'ssize
attribute when saving the object.Using
SWIFT_CONTENT_LENGTH_FROM_FD: False
will sendcontent_length = None
, allowing the SWIFT backend to determine the content length using the content read.This is a workaround for a bug we encountered with Django ContentFile objects (prior to Django2) which can mis-report their size if changed after initialisation. See added
test_no_content_length_from_fd()
for example.Reviewers