diff options
Diffstat (limited to 'source/features/enable-file-links-in-compare-view.tsx')
-rw-r--r-- | source/features/enable-file-links-in-compare-view.tsx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/features/enable-file-links-in-compare-view.tsx b/source/features/enable-file-links-in-compare-view.tsx index 1b374f2b..2bf1edb8 100644 --- a/source/features/enable-file-links-in-compare-view.tsx +++ b/source/features/enable-file-links-in-compare-view.tsx @@ -6,15 +6,16 @@ import * as pageDetect from 'github-url-detection'; import features from '.'; import GitHubURL from '../github-helpers/github-url'; -import {getCurrentBranch, getPRHeadRepo} from '../github-helpers'; /** Rebuilds the "View file" link because it points to the base repo and to the commit, instead of the head repo and its branch */ function handlePRMenuOpening({delegateTarget: dropdown}: delegate.Event): void { dropdown.classList.add('rgh-actionable-link'); // Mark this as processed + + const [nameWithOwner, headBranch] = select('.head-ref')!.title.split(':'); const filePath = dropdown.closest('[data-path]')!.getAttribute('data-path')!; - const viewFile = select('a[data-ga-click^="View file"]', dropdown)!; - viewFile.pathname = [getPRHeadRepo()!.nameWithOwner, 'blob', getCurrentBranch()!, filePath].join('/'); // Do not replace with `GitHubURL` #3152 #3111 #2595 + select('a[data-ga-click^="View file"]', dropdown)! + .pathname = [nameWithOwner, 'blob', headBranch, filePath].join('/'); // Do not replace with `GitHubURL` #3152 #3111 #2595 } function handleCompareMenuOpening({delegateTarget: dropdown}: delegate.Event): void { |