Skip to content

Commit 956154c

Browse files
committed
fix logic to detect topics & repositories on the new Stars browser UI
1 parent fa7fef0 commit 956154c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -812,16 +812,18 @@ TEST: addTests('isRepositoryActions', [
812812
'https://github.com/refined-github/github-url-detection/actions/workflows/esm-lint.yml',
813813
]);
814814

815-
export const isStars = (url: URL | HTMLAnchorElement | Location = location): boolean => {
816-
const patharr = getCleanPathname(url).split('/'), [stars, user, lists, ...extra] = patharr;
815+
const isStars = (url: URL | HTMLAnchorElement | Location = location): boolean => {
816+
const patharr = getCleanPathname(url).split('/'), [stars, user, subpath, ...extra] = patharr;
817817
return stars === 'stars'
818818
&& ([1, 2, 4].includes(patharr.length)
819-
|| lists === 'lists' && extra.length !== 0);
820-
};
819+
|| subpath === 'lists' && patharr.length !== 3
820+
|| ['repositories', 'topics'].includes(subpath) && patharr.length == 3);
821+
}
821822
TEST: addTests('isStars', [
822823
'https://github.com/stars',
823824
'https://github.com/stars/lstn',
824825
'https://github.com/stars/lstn/repositories',
826+
'https://github.com/stars/lstn/topics',
825827
'https://github.com/stars/lstn/lists/test'
826828
]);
827829

0 commit comments

Comments
 (0)