diff options
Diffstat (limited to 'ruby/lib/gitaly_server/repository_service.rb')
-rw-r--r-- | ruby/lib/gitaly_server/repository_service.rb | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/ruby/lib/gitaly_server/repository_service.rb b/ruby/lib/gitaly_server/repository_service.rb index cd84ee180..514e80723 100644 --- a/ruby/lib/gitaly_server/repository_service.rb +++ b/ruby/lib/gitaly_server/repository_service.rb @@ -7,12 +7,22 @@ module GitalyServer def find_license(request, call) repo = Gitlab::Git::Repository.from_gitaly(request.repository, call) - short_name = begin - ::Licensee.license(repo.path).try(:key) - rescue Rugged::Error - end + begin + project = ::Licensee.project(repo.path) + return Gitaly::FindLicenseResponse.new(license_short_name: "") unless project&.license - Gitaly::FindLicenseResponse.new(license_short_name: short_name || "") + license = project.license + return Gitaly::FindLicenseResponse.new( + license_short_name: license.key || "", + license_name: license.name || "", + license_url: license.url || "", + license_path: project.matched_file&.filename, + license_nickname: license.nickname || "" + ) + rescue Rugged::Error + end + + Gitaly::FindLicenseResponse.new(license_short_name: "") end end end |