Skip to content

Commit ce730d0

Browse files
authored
consider other common license files present in projects (#275)
1 parent 674fd27 commit ce730d0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/repo.v

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,11 @@ fn find_readme_file(items []File) ?File {
832832
}
833833

834834
fn find_license_file(items []File) ?File {
835-
files := items.filter(it.name.to_lower() == 'license')
835+
// List of common license file names
836+
license_common_files := ['license', 'license.md', 'license.txt', 'licence', 'licence.md', 'licence.txt']
837+
838+
files := items.filter(license_common_files.contains(it.name.to_lower()))
839+
836840
if files.len == 0 {
837841
return none
838842
}

src/repo_routes.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ pub fn (mut app App) tree(mut ctx Context, username string, repo_name string, br
420420
mut license_file_path := ''
421421

422422
if license_file.id != 0 {
423-
license_file_path = '/${username}/${repo_name}/blob/${branch_name}/LICENSE'
423+
license_file_path = '/${username}/${repo_name}/blob/${branch_name}/${license_file.name}'
424424
}
425425

426426
watcher_count := app.get_count_repo_watchers(repo_id)

0 commit comments

Comments
 (0)