Skip to content

Commit

Permalink
index: allow #fragments in PR URLs
Browse files Browse the repository at this point in the history
Also check tightened PR_RE against pathname
  • Loading branch information
TimothyGu committed Jan 29, 2017
1 parent af66e3f commit f30ffde
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict'

const PR_RE = /\/nodejs\/([^\/]+)\/pull\/([^\/]+)\/?$/
const PR_RE = /^\/nodejs\/([^\/]+)\/pull\/([^\/]+)\/?$/

const b = chrome.extension.getBackgroundPage()
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
if (changeInfo.url === undefined) return
if (PR_RE.test(changeInfo.url)) {
if (PR_RE.test(new URL(changeInfo.url).pathname)) {
chrome.browserAction.enable()
chrome.browserAction.setIcon({
path: 'icon_good.png'
Expand Down
2 changes: 1 addition & 1 deletion review.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
, REJECTED: 'REJECTED'
}

const PR_RE = /\/nodejs\/([^\/]+)\/pull\/([^\/]+)\/?$/
const PR_RE = /^\/nodejs\/([^\/]+)\/pull\/([^\/]+)\/?$/

const { prUrl, repo } = getPR()
if (!prUrl) {
Expand Down

0 comments on commit f30ffde

Please sign in to comment.