mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-17 15:39:00 +00:00
Set a better content type for data downloads.
This commit is contained in:
parent
fbd6dbda47
commit
2292d64fcd
@ -596,6 +596,12 @@ def read_share_chunk(
|
||||
if response.code == http.NO_CONTENT:
|
||||
return b""
|
||||
|
||||
content_type = get_content_type(response.headers)
|
||||
if content_type != "application/octet-stream":
|
||||
raise ValueError(
|
||||
f"Content-type was wrong: {content_type}, should be application/octet-stream"
|
||||
)
|
||||
|
||||
if response.code == http.PARTIAL_CONTENT:
|
||||
content_range = parse_content_range_header(
|
||||
response.headers.getRawHeaders("content-range")[0] or ""
|
||||
|
@ -778,6 +778,7 @@ class HTTPServer(object):
|
||||
)
|
||||
def read_share_chunk(self, request, authorization, storage_index, share_number):
|
||||
"""Read a chunk for an already uploaded immutable."""
|
||||
request.setHeader("content-type", "application/octet-stream")
|
||||
try:
|
||||
bucket = self._storage_server.get_buckets(storage_index)[share_number]
|
||||
except KeyError:
|
||||
@ -883,7 +884,8 @@ class HTTPServer(object):
|
||||
)
|
||||
def read_mutable_chunk(self, request, authorization, storage_index, share_number):
|
||||
"""Read a chunk from a mutable."""
|
||||
|
||||
request.setHeader("content-type", "application/octet-stream")
|
||||
|
||||
try:
|
||||
share_length = self._storage_server.get_mutable_share_length(
|
||||
storage_index, share_number
|
||||
|
Loading…
x
Reference in New Issue
Block a user