perf: applet 上传检查版本

pull/11311/head
ibuler 2023-08-17 10:54:35 +08:00
parent 9317d9e35e
commit 769d5fbd96
3 changed files with 526 additions and 514 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -60,6 +60,10 @@ class DownloadUploadMixin:
name = manifest['name']
update = request.query_params.get('update')
is_enterprise = manifest.get('edition') == Applet.Edition.enterprise
if is_enterprise and not settings.XPACK_ENABLED:
raise ValidationError({'error': _('This is enterprise edition applet')})
instance = Applet.objects.filter(name=name).first()
if instance and not update:
return Response({'error': 'Applet already exists: {}'.format(name)}, status=400)