修改存储添加失败问题

dependabot/npm_and_yarn/fir_admin/terser-4.8.1
isummer 2 years ago
parent 7d70f381a1
commit 7075bc7ed6
  1. 8
      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}') raise ValidationError(f'endpoint [{endpoint}] not in {Config.STORAGE_ALLOW_ENDPOINT}')
max_storage_capacity = attrs.get('storage_capacity', -1) max_storage_capacity = attrs.get('storage_capacity', -1)
if max_storage_capacity != -1: if max_storage_capacity != -1:
attrs['max_storage_capacity'] = max_storage_capacity * 1024 * 1024 if max_storage_capacity == 0:
elif max_storage_capacity == 0: attrs['max_storage_capacity'] = Config.STORAGE_OSS_CAPACITY
attrs['max_storage_capacity'] = Config.STORAGE_OSS_CAPACITY else:
else: attrs['max_storage_capacity'] = max_storage_capacity * 1024 * 1024
del attrs['storage_capacity'] del attrs['storage_capacity']
return attrs return attrs

Loading…
Cancel
Save