File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
src/components/ViewPackagePage Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -80,14 +80,11 @@ export default function ImportantFilesView({
8080 isOwner || Boolean ( organization ?. user_permissions ?. can_manage_org )
8181 // File type utilities
8282 const isLicenseFile = useCallback ( ( filePath : string ) => {
83- const lowerPath = filePath . toLowerCase ( )
83+ const lowerPath = filePath . toLowerCase ( ) . replace ( / ^ \/ / , "" )
8484 return (
8585 lowerPath === "license" ||
86- lowerPath . endsWith ( "/license" ) ||
8786 lowerPath === "license.txt" ||
88- lowerPath . endsWith ( "/license.txt" ) ||
89- lowerPath === "license.md" ||
90- lowerPath . endsWith ( "/license.md" )
87+ lowerPath === "license.md"
9188 )
9289 } , [ ] )
9390
@@ -161,7 +158,12 @@ export default function ImportantFilesView({
161158 const isSubdirReadme =
162159 ( lowerPath . endsWith ( "/readme.md" ) || lowerPath . endsWith ( "/readme" ) ) &&
163160 ! isReadmeFile ( file . file_path )
164- return ! isSubdirReadme
161+ const isSubdirLicense =
162+ ( lowerPath . endsWith ( "/license" ) ||
163+ lowerPath . endsWith ( "/license.txt" ) ||
164+ lowerPath . endsWith ( "/license.md" ) ) &&
165+ ! isLicenseFile ( file . file_path )
166+ return ! isSubdirReadme && ! isSubdirLicense
165167 } )
166168
167169 filteredFiles . forEach ( ( file ) => {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ const importanceMap = {
33 readme : 200 ,
44 license : 100 ,
55 "license.md" : 100 ,
6+ "license.txt" : 100 ,
67 "index.ts" : 90 ,
78 "index.tsx" : 90 ,
89 "circuit.tsx" : 90 ,
You can’t perform that action at this time.
0 commit comments