From f86246bc12d3e394aaf7dc3b8c9020fbb6eb52f6 Mon Sep 17 00:00:00 2001 From: brmassa Date: Fri, 21 Mar 2025 17:29:46 -0500 Subject: [PATCH 1/2] fix: consider other common license files present in projects --- src/repo.v | 6 +++++- src/repo_routes.v | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/repo.v b/src/repo.v index e249ea3c..cb7a4c7a 100644 --- a/src/repo.v +++ b/src/repo.v @@ -832,7 +832,11 @@ fn find_readme_file(items []File) ?File { } fn find_license_file(items []File) ?File { - files := items.filter(it.name.to_lower() == 'license') + // List of common license file names + license_common_files := ['license', 'license.md', 'license.txt', 'licence', 'licence.md', 'licence.txt'] + + files := items.filter(license_common_files.contains(it.name.to_lower())) + if files.len == 0 { return none } diff --git a/src/repo_routes.v b/src/repo_routes.v index 77b55ca9..f154dc86 100644 --- a/src/repo_routes.v +++ b/src/repo_routes.v @@ -418,9 +418,9 @@ pub fn (mut app App) tree(mut ctx Context, username string, repo_name string, br license_file := find_license_file(items) or { File{} } mut license_file_path := '' - + println(license_file) if license_file.id != 0 { - license_file_path = '/${username}/${repo_name}/blob/${branch_name}/LICENSE' + license_file_path = '/${username}/${repo_name}/blob/${branch_name}/${license_file.name}' } watcher_count := app.get_count_repo_watchers(repo_id) From f553b52af77c5584e309b4d88e2d0868b9b26f1c Mon Sep 17 00:00:00 2001 From: brmassa Date: Sat, 22 Mar 2025 20:35:16 -0500 Subject: [PATCH 2/2] fix: remove the debug println --- src/repo_routes.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/repo_routes.v b/src/repo_routes.v index f154dc86..a6b11756 100644 --- a/src/repo_routes.v +++ b/src/repo_routes.v @@ -418,7 +418,7 @@ pub fn (mut app App) tree(mut ctx Context, username string, repo_name string, br license_file := find_license_file(items) or { File{} } mut license_file_path := '' - println(license_file) + if license_file.id != 0 { license_file_path = '/${username}/${repo_name}/blob/${branch_name}/${license_file.name}' }