parent
b95f47ee73
commit
664a2951cc
1 changed files with 4 additions and 3 deletions
|
@ -38,7 +38,6 @@ def _base_blob_fetch(namespace, repo_name, digest):
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
'Docker-Content-Digest': digest,
|
'Docker-Content-Digest': digest,
|
||||||
'Content-Length': found.image_size,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add the Accept-Ranges header if the storage engine supports resumable
|
# Add the Accept-Ranges header if the storage engine supports resumable
|
||||||
|
@ -56,11 +55,11 @@ def _base_blob_fetch(namespace, repo_name, digest):
|
||||||
@anon_protect
|
@anon_protect
|
||||||
@cache_control(max_age=31436000)
|
@cache_control(max_age=31436000)
|
||||||
def check_blob_exists(namespace, repo_name, digest):
|
def check_blob_exists(namespace, repo_name, digest):
|
||||||
_, headers = _base_blob_fetch(namespace, repo_name, digest)
|
found, headers = _base_blob_fetch(namespace, repo_name, digest)
|
||||||
|
|
||||||
response = make_response('')
|
response = make_response('')
|
||||||
response.headers.extend(headers)
|
response.headers.extend(headers)
|
||||||
response.headers['Content-Length'] = headers['Content-Length']
|
response.headers['Content-Length'] = found.image_size
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,6 +86,8 @@ def download_blob(namespace, repo_name, digest):
|
||||||
# Close the database handle here for this process before we send the long download.
|
# Close the database handle here for this process before we send the long download.
|
||||||
database.close_db_filter(None)
|
database.close_db_filter(None)
|
||||||
|
|
||||||
|
headers['Content-Length'] = found.image_size
|
||||||
|
|
||||||
return Response(storage.stream_read(found.locations, path), headers=headers)
|
return Response(storage.stream_read(found.locations, path), headers=headers)
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue