From 7075bc7ed6dee52623ab8dc3dd8749124cbe5d30 Mon Sep 17 00:00:00 2001 From: isummer Date: Tue, 12 Jul 2022 16:55:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=98=E5=82=A8=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fir_ser/api/utils/serializer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fir_ser/api/utils/serializer.py b/fir_ser/api/utils/serializer.py index 40c235e..4fbd317 100644 --- a/fir_ser/api/utils/serializer.py +++ b/fir_ser/api/utils/serializer.py @@ -388,10 +388,10 @@ class StorageSerializer(serializers.ModelSerializer): raise ValidationError(f'endpoint [{endpoint}] not in {Config.STORAGE_ALLOW_ENDPOINT}') max_storage_capacity = attrs.get('storage_capacity', -1) if max_storage_capacity != -1: - attrs['max_storage_capacity'] = max_storage_capacity * 1024 * 1024 - elif max_storage_capacity == 0: - attrs['max_storage_capacity'] = Config.STORAGE_OSS_CAPACITY - else: + if max_storage_capacity == 0: + attrs['max_storage_capacity'] = Config.STORAGE_OSS_CAPACITY + else: + attrs['max_storage_capacity'] = max_storage_capacity * 1024 * 1024 del attrs['storage_capacity'] return attrs