diff options
author | Toon Claes <toon@gitlab.com> | 2022-08-26 18:02:23 +0300 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2022-10-03 12:46:27 +0300 |
commit | 3b8c7e1ac249135f4f4d03407fffd7be86c361e9 (patch) | |
tree | 7da546fe765862ff00ed59c716275ca4df019211 | |
parent | 4c15523cf680c107c5aa2b8268674cd0345a6b78 (diff) |
repository: Omit broken "other" license URL
The URL used by the "Other" license gives a 404, so remove it.
-rw-r--r-- | internal/gitaly/service/repository/license.go | 1 | ||||
-rw-r--r-- | internal/gitaly/service/repository/license_test.go | 6 | ||||
-rw-r--r-- | ruby/lib/gitaly_server/repository_service.rb | 7 |
3 files changed, 11 insertions, 3 deletions
diff --git a/internal/gitaly/service/repository/license.go b/internal/gitaly/service/repository/license.go index 4d1b8fd43..900c1fa89 100644 --- a/internal/gitaly/service/repository/license.go +++ b/internal/gitaly/service/repository/license.go @@ -61,7 +61,6 @@ func (s *server) FindLicense(ctx context.Context, req *gitalypb.FindLicenseReque return &gitalypb.FindLicenseResponse{ LicenseName: "Other", LicenseShortName: "other", - LicenseUrl: "http://choosealicense.com/licenses/other/", LicensePath: repoFiler.path, }, nil } diff --git a/internal/gitaly/service/repository/license_test.go b/internal/gitaly/service/repository/license_test.go index 23059844a..b4b6709ff 100644 --- a/internal/gitaly/service/repository/license_test.go +++ b/internal/gitaly/service/repository/license_test.go @@ -90,7 +90,11 @@ SOFTWARE.`, }, expectedLicenseRuby: &gitalypb.FindLicenseResponse{ LicenseShortName: "other", - LicenseUrl: "http://choosealicense.com/licenses/other/", + LicenseName: "Other", + LicensePath: "LICENSE.md", + }, + expectedLicenseGo: &gitalypb.FindLicenseResponse{ + LicenseShortName: "other", LicenseName: "Other", LicensePath: "LICENSE.md", }, diff --git a/ruby/lib/gitaly_server/repository_service.rb b/ruby/lib/gitaly_server/repository_service.rb index 514e80723..20197cd43 100644 --- a/ruby/lib/gitaly_server/repository_service.rb +++ b/ruby/lib/gitaly_server/repository_service.rb @@ -12,13 +12,18 @@ module GitalyServer return Gitaly::FindLicenseResponse.new(license_short_name: "") unless project&.license 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 || "" - ) + ).tap do |resp| + if license.key == "other" + resp.license_url = "" + end + end rescue Rugged::Error end |