Address torrent feature review comments.
This commit is contained in:
parent
8a924aae4a
commit
1ae101c917
7 changed files with 31 additions and 29 deletions
|
@ -309,6 +309,7 @@ def get_tag_torrent(namespace, repo_name, digest):
|
|||
|
||||
user = get_authenticated_user()
|
||||
if user is None and not public_repo:
|
||||
# We can not generate a private torrent cluster without a user uuid (e.g. token auth)
|
||||
abort(403)
|
||||
|
||||
try:
|
||||
|
@ -320,7 +321,7 @@ def get_tag_torrent(namespace, repo_name, digest):
|
|||
webseed = storage.get_direct_download_url(blob.locations, path)
|
||||
if webseed is None:
|
||||
# We cannot support webseeds for storages that cannot provide direct downloads.
|
||||
abort(501)
|
||||
abort(make_response('Storage engine does not support seeding.', 501))
|
||||
|
||||
try:
|
||||
torrent_info = model.storage.get_torrent_info(blob)
|
||||
|
@ -331,6 +332,7 @@ def get_tag_torrent(namespace, repo_name, digest):
|
|||
name = public_torrent_filename(blob.uuid)
|
||||
else:
|
||||
name = per_user_torrent_filename(user.uuid, blob.uuid)
|
||||
|
||||
torrent_file = make_torrent(name, webseed, blob.image_size,
|
||||
torrent_info.piece_length, torrent_info.pieces)
|
||||
|
||||
|
|
Reference in a new issue