mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
AsyncMixin: Fix crash on invalid query string (PRETIXEU-AHG)
This commit is contained in:
@@ -30,7 +30,9 @@ from celery import states
|
||||
from celery.result import AsyncResult
|
||||
from django.conf import settings
|
||||
from django.contrib import messages
|
||||
from django.core.exceptions import PermissionDenied, ValidationError
|
||||
from django.core.exceptions import (
|
||||
BadRequest, PermissionDenied, ValidationError,
|
||||
)
|
||||
from django.core.files.uploadedfile import UploadedFile
|
||||
from django.db import transaction
|
||||
from django.http import HttpResponse, JsonResponse, QueryDict
|
||||
@@ -131,6 +133,8 @@ class AsyncMixin:
|
||||
return data
|
||||
|
||||
def get_result(self, request):
|
||||
if not request.GET.get('async_id'):
|
||||
raise BadRequest("No async_id given")
|
||||
res = AsyncResult(request.GET.get('async_id'))
|
||||
if 'ajax' in self.request.GET:
|
||||
return JsonResponse(self._return_ajax_result(res, timeout=0.25))
|
||||
@@ -208,6 +212,8 @@ class AsyncAction(AsyncMixin):
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
if 'async_id' in request.GET and settings.HAS_CELERY:
|
||||
if not request.GET.get('async_id'):
|
||||
raise BadRequest("No async_id given")
|
||||
return self.get_result(request)
|
||||
return self.http_method_not_allowed(request)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user