Skip to content

Commit

Permalink
[api] disallow project and packages with the name "0"
Browse files Browse the repository at this point in the history
backend is not allowing it. People can trap themself by
creating it without a way to remove it.
  • Loading branch information
adrianschroeter committed May 20, 2016
1 parent a1a7ddf commit 3831e57
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/api/app/models/package.rb
Expand Up @@ -988,6 +988,7 @@ def self.valid_name?(name)
return false unless name.kind_of? String
# this length check is duplicated but useful for other uses for this function
return false if name.length > 200 || name.blank?
return false if name == "0"
return true if name =~ /\A_product:\w[-+\w\.]*\z/
# obsolete, just for backward compatibility
return true if name =~ /\A_patchinfo:\w[-+\w\.]*\z/
Expand Down
1 change: 1 addition & 0 deletions src/api/app/models/project.rb
Expand Up @@ -1407,6 +1407,7 @@ def self.valid_name?(name)
return false unless name.kind_of? String
# this length check is duplicated but useful for other uses for this function
return false if name.length > 200 || name.blank?
return false if name == "0";
return false if name =~ %r{^[_\.]}
return false if name =~ %r{::}
return false if name.end_with?(':')
Expand Down

0 comments on commit 3831e57

Please sign in to comment.