Skip to content

Commit 8483fcf

Browse files
committed
fix(pr-2-jira): make detectPageType more precise
Changed from simple pathname.includes('/pull/') to regex /\/pull\/\d+\/?$/ to match only base PR pages like /pull/7323, not subpages like /pull/7323/commits or /pull/7323/files. This prevents the script from running on commit list pages and other PR-related subpages, only activating on the main PR discussion page.
1 parent 53f366c commit 8483fcf

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

scripts/pr-2-jira.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name PR-2-Jira: GitHub & Jira Integration
33
// @namespace https://github.com/scharinger/userscripts
4-
// @version 2.4
4+
// @version 2.5
55
// @description Seamlessly connect GitHub PRs to Jira with smart button placement and automatic link creation
66
// @author Tim Scharinger
77
// @match https://*/*/pull/*
@@ -45,7 +45,8 @@
4545
const hostname = window.location.hostname.toLowerCase()
4646
const pathname = window.location.pathname
4747

48-
if (hostname.includes('github') && pathname.includes('/pull/')) {
48+
// Match GitHub PR pages but not commits/files/etc subpages
49+
if (hostname.includes('github') && /\/pull\/\d+\/?$/.test(pathname)) {
4950
return 'github'
5051
} else if (hostname.includes('jira') && pathname.includes('/browse/')) {
5152
return 'jira'

0 commit comments

Comments
 (0)