fix: sftp不能设置为默认存储 (#12213)

Co-authored-by: wangruidong <940853815@qq.com>
pull/12216/head
fit2bot 2023-11-28 15:21:40 +08:00 committed by GitHub
parent 01e40fd238
commit d2498c0d53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -281,3 +281,10 @@ class ReplayStorageSerializer(BaseStorageSerializer):
extra_kwargs = {
'name': {'validators': [UniqueValidator(queryset=ReplayStorage.objects.all())]}
}
def validate_is_default(self, value):
if self.initial_data.get('type') == const.ReplayStorageType.sftp.value:
# sftp不能设置为默认存储
return False
else:
return value