packages/s3ql: correctly send body length for plain data

This commit is contained in:
Max Headroom 2024-06-07 22:33:53 +02:00
parent 6f6883f4a1
commit dd2633413a

View file

@ -0,0 +1,26 @@
diff --git a/src/s3ql/backends/comprenc.py b/src/s3ql/backends/comprenc.py
index 6402fec1..9ed3627e 100644
--- a/src/s3ql/backends/comprenc.py
+++ b/src/s3ql/backends/comprenc.py
@@ -276,7 +276,7 @@ class ComprencBackend(AbstractBackend):
buf.seek(0)
fh = buf
- return self.backend.write_fh(key, fh, meta_raw)
+ return self.backend.write_fh(key, fh, meta_raw, len_=len_ if meta_raw['compression'] == 'None'and meta_raw['encryption'] == 'None' else None)
def contains(self, key):
return self.backend.contains(key)
diff --git a/src/s3ql/database.py b/src/s3ql/database.py
index bb4054e6..c2142bf6 100644
--- a/src/s3ql/database.py
+++ b/src/s3ql/database.py
@@ -659,7 +659,7 @@ def upload_metadata(
)
obj = METADATA_OBJ_NAME % (blockno, params.seq_no)
fh.seek(blockno * blocksize)
- backend.write_fh(obj, fh, len_=blocksize)
+ backend.write_fh(obj, fh, len_=min(blocksize, db_size - blockno * blocksize))
if not update_params:
return