summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-05-22 11:29:10 -0700
committerStan Hu <stanhu@gmail.com>2019-05-22 11:32:23 -0700
commit5c8cd42bbd6a387f5e73c688615c54606810983e (patch)
tree9d4a4bdf0a16c737eb9f83645ce935ced7a11747 /lib
parent20375f811a6ffa35568d70b97a3793b97231d0dd (diff)
downloadgitlab-ce-5c8cd42bbd6a387f5e73c688615c54606810983e.tar.gz
Fix invalid visibility string comparison in project import
This resolves an "ArgumentError: comparison of String with 0 failed" issue where the visibility_level is stored as a string in the project import data because the value comes directly from the Web form. This problem happened upon creating a project from a template or restoring a project. We now cast the value to an integer to guard against these kinds of failures. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/61692
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/import_export/project_tree_restorer.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gitlab/import_export/project_tree_restorer.rb b/lib/gitlab/import_export/project_tree_restorer.rb
index 51001750a6c..20caadb89c0 100644
--- a/lib/gitlab/import_export/project_tree_restorer.rb
+++ b/lib/gitlab/import_export/project_tree_restorer.rb
@@ -129,7 +129,7 @@ module Gitlab
def visibility_level
level = override_params['visibility_level'] || json_params['visibility_level'] || @project.visibility_level
- level = @project.group.visibility_level if @project.group && level > @project.group.visibility_level
+ level = @project.group.visibility_level if @project.group && level.to_i > @project.group.visibility_level
{ 'visibility_level' => level }
end