summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <zegerjan@localhost.localdomain>2015-10-01 20:34:23 +0200
committerZeger-Jan van de Weg <mail@zjvandeweg.nl>2015-10-15 21:50:15 +0200
commit3f08e4b186bd02b37f34ccf1bc641a95f9d865ce (patch)
tree139b27b544c27bd67d510c199a23628a089e8624 /app
parent7248566632d5de39e7b57594dcf6e021ae912282 (diff)
downloadgitlab-ce-3f08e4b186bd02b37f34ccf1bc641a95f9d865ce.tar.gz
Add specs on #license
Diffstat (limited to 'app')
-rw-r--r--app/models/repository.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index dc7cd926745..8cd182e1b0b 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -216,7 +216,11 @@ class Repository
# If `licence`, `copying` and `copying.lesser` are found, return in the
# following order: licence, copying, copying.lesser
- licenses.find { |l| l =~ /\Alicence/i } || licenses.sort.first
+ regex = [/\Alicense(\..*)?\z/i, /\Acopying(\..{0,3})?\z/i, /\Acopying.lesser/i]
+
+ regex.map do |re|
+ licenses.find { |l| l.name =~ re }
+ end.compact.first
end
end