From b565aa62c5a1e75e7f7e28abc30c975d6a4884ba Mon Sep 17 00:00:00 2001 From: Gerrod Date: Tue, 12 Aug 2025 15:13:27 -0400 Subject: [PATCH] Merge pull request #931 from gerrod3/group-upload-task-fix Fixed group uploads failing when using domains (cherry picked from commit ae16f6a7f6ec106fea10c38b9d81551cc3c7c5ec) --- CHANGES/929.bugfix | 1 + pulp_python/app/pypi/views.py | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 CHANGES/929.bugfix diff --git a/CHANGES/929.bugfix b/CHANGES/929.bugfix new file mode 100644 index 00000000..fb49d5e5 --- /dev/null +++ b/CHANGES/929.bugfix @@ -0,0 +1 @@ +Fixed PYTHON_GROUP_UPLOADS failing when domains are turned on. \ No newline at end of file diff --git a/pulp_python/app/pypi/views.py b/pulp_python/app/pypi/views.py index 0174c937..03039db5 100644 --- a/pulp_python/app/pypi/views.py +++ b/pulp_python/app/pypi/views.py @@ -8,7 +8,6 @@ from django.shortcuts import redirect from datetime import datetime, timezone, timedelta -from rest_framework.reverse import reverse from django.contrib.sessions.models import Session from django.db import transaction from django.db.utils import DatabaseError @@ -29,7 +28,7 @@ from pulpcore.plugin.viewsets import OperationPostponedResponse from pulpcore.plugin.tasking import dispatch -from pulpcore.plugin.util import get_domain +from pulpcore.plugin.util import get_domain, get_url from pulpcore.plugin.exceptions import TimeoutException from pulp_python.app.models import ( PythonDistribution, @@ -200,10 +199,15 @@ def create_group_upload_task(self, cur_session, repository, artifact, filename, cur_session['artifacts'] = [(str(artifact.sha256), filename)] cur_session.modified = False cur_session.save() - result = dispatch(tasks.upload_group, exclusive_resources=[artifact, repository], - kwargs={"session_pk": str(cur_session.session_key), - "repository_pk": str(repository.pk)}) - return reverse('tasks-detail', args=[result.pk], request=None) + task = dispatch( + tasks.upload_group, + exclusive_resources=[artifact, repository], + kwargs={ + "session_pk": str(cur_session.session_key), + "repository_pk": str(repository.pk), + }, + ) + return get_url(task) class SimpleView(PackageUploadMixin, ViewSet):