related #7665 added 400 if user attempts an edit to local_path in a SCM project and test case

This commit is contained in:
Jake Jackson
2020-10-23 17:11:06 -04:00
parent a71261d5fd
commit dbc4b677f6
2 changed files with 11 additions and 0 deletions

View File

@@ -1333,6 +1333,8 @@ class ProjectOptionsSerializer(BaseSerializer):
scm_type = attrs.get('scm_type', u'') or u''
if self.instance and not scm_type:
valid_local_paths.append(self.instance.local_path)
if scm_type and self.instance.local_path != attrs.get('local_path'):
errors['local_path'] = _(f'Cannot change local_path for {scm_type}-based projects')
if scm_type:
attrs.pop('local_path', None)
if 'local_path' in attrs and attrs['local_path'] not in valid_local_paths: