diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-07-26 00:27:46 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-07-27 13:52:45 -0300 |
commit | 487dfad6acf4175275352094edf418dca6c8cfd6 (patch) | |
tree | 1572738df315d83c50923d0af8c7ce1bdbe263da /app/services/projects | |
parent | ac7f3e6a9201778e796394d54f86f45f7d789dc9 (diff) | |
download | gitlab-ce-487dfad6acf4175275352094edf418dca6c8cfd6.tar.gz |
Fix renaming repository when name contains invalid chars under settings
Diffstat (limited to 'app/services/projects')
-rw-r--r-- | app/services/projects/update_service.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/services/projects/update_service.rb b/app/services/projects/update_service.rb index f06311511cc..032c3b182fb 100644 --- a/app/services/projects/update_service.rb +++ b/app/services/projects/update_service.rb @@ -3,7 +3,7 @@ module Projects def execute # check that user is allowed to set specified visibility_level new_visibility = params[:visibility_level] - + if new_visibility && new_visibility.to_i != project.visibility_level unless can?(current_user, :change_visibility_level, project) && Gitlab::VisibilityLevel.allowed_for?(current_user, new_visibility) @@ -23,7 +23,17 @@ module Projects if project.previous_changes.include?('path') project.rename_repo end + else + restore_attributes + false end end + + private + + def restore_attributes + project.path = project.path_was if project.errors.include?(:path) + project.name = project.name_was if project.errors.include?(:name) + end end end |