Skip to content

Commit 278a6d2

Browse files
authored
Exclude gists from isNewRepo (#203)
1 parent a359e5b commit 278a6d2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export const isGist = (url: URL | HTMLAnchorElement | Location = location): bool
100100
TEST: addTests('isGist', [
101101
'https://gist.github.com',
102102
'http://gist.github.com',
103+
'https://gist.github.com/new',
103104
'https://gist.github.com/fregante/2205329b71218fa2c1d3',
104105
'https://gist.github.com/fregante/2205329b71218fa2c1d3/d1ebf7d9cfaba4d4596d2ea9174e202479a5f9ad',
105106
'https://gist.github.com/sindresorhus/0ea3c2845718a0a0f0beb579ff14f064',
@@ -756,7 +757,7 @@ export const canUserAdminRepo = (): boolean => isRepo() && exists('.reponav-item
756757
/** @deprecated Use `canUserAdminRepo` */
757758
export const canUserEditRepo = canUserAdminRepo;
758759

759-
export const isNewRepo = (url: URL | HTMLAnchorElement | Location = location): boolean => url.pathname === '/new' || /^organizations\/[^/]+\/repositories\/new$/.test(getCleanPathname(url));
760+
export const isNewRepo = (url: URL | HTMLAnchorElement | Location = location): boolean => !isGist(url) && (url.pathname === '/new' || /^organizations\/[^/]+\/repositories\/new$/.test(getCleanPathname(url)));
760761
TEST: addTests('isNewRepo', [
761762
'https://github.com/new',
762763
'https://github.com/organizations/npmhub/repositories/new',

0 commit comments

Comments
 (0)