Skip to content

Commit 6cbc94f

Browse files
fix: make retriable uploads retriable even if no error
1 parent 061ed90 commit 6cbc94f

File tree

1 file changed

+10
-25
lines changed
  • libs/shared/shared/django_apps/upload_breadcrumbs

1 file changed

+10
-25
lines changed

libs/shared/shared/django_apps/upload_breadcrumbs/admin.py

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,6 @@ def get_urls(self):
560560
@admin.display(description="Actions", ordering=None)
561561
def resend_upload_button(self, obj: UploadBreadcrumb) -> str:
562562
"""Display resend button in the list view for failed uploads."""
563-
if not self._is_failed_upload(obj):
564-
return "-"
565-
566563
resend_url = reverse(
567564
"admin:upload_breadcrumbs_uploadbreadcrumb_resend_upload", args=[obj.id]
568565
)
@@ -577,24 +574,16 @@ def resend_upload_action(self, obj: UploadBreadcrumb) -> str:
577574
if not obj.pk: # New object
578575
return "-"
579576

580-
html_parts = []
581-
582-
if self._is_failed_upload(obj):
583-
resend_url = reverse(
584-
"admin:upload_breadcrumbs_uploadbreadcrumb_resend_upload", args=[obj.id]
585-
)
586-
html_parts.append(
587-
f'<a class="button default" href="{resend_url}" '
588-
f"onclick=\"return confirm('Are you sure you want to resend this upload for commit {obj.commit_sha[:7]}?')\">🔄 Resend Upload</a>"
589-
"<br><br>"
590-
"<div><strong>⚠️ Note:</strong> This will create a new upload task for the same commit and repository. "
591-
"The original upload data may no longer be available in storage.</div>"
592-
)
593-
else:
594-
html_parts.append(
595-
"<div>✅ This upload does not appear to have failed. Resend option is not available.</div>"
596-
)
597-
577+
resend_url = reverse(
578+
"admin:upload_breadcrumbs_uploadbreadcrumb_resend_upload", args=[obj.id]
579+
)
580+
html_parts = [
581+
f'<a class="button default" href="{resend_url}" '
582+
f"onclick=\"return confirm('Are you sure you want to resend this upload for commit {obj.commit_sha[:7]}?')\">🔄 Resend Upload</a>"
583+
"<br><br>"
584+
"<div><strong>⚠️ Note:</strong> This will create a new upload task for the same commit and repository. "
585+
"The original upload data may no longer be available in storage.</div>"
586+
]
598587
return format_html("".join(html_parts))
599588

600589
def _is_failed_upload(self, obj: UploadBreadcrumb) -> bool:
@@ -624,10 +613,6 @@ def resend_upload_view(self, request, object_id):
624613
messages.error(request, "Upload breadcrumb not found.")
625614
return redirect("admin:upload_breadcrumbs_uploadbreadcrumb_changelist")
626615

627-
if not self._is_failed_upload(breadcrumb):
628-
messages.error(request, "This upload does not appear to have failed.")
629-
return redirect("admin:upload_breadcrumbs_uploadbreadcrumb_changelist")
630-
631616
success, error_message = self._resend_upload(breadcrumb, request.user)
632617

633618
if success:

0 commit comments

Comments
 (0)