summaryrefslogtreecommitdiff
path: root/source/features/patch-diff-links.tsx
diff options
context:
space:
mode:
authorGravatar Kid <44045911+kidonng@users.noreply.github.com> 2022-07-12 20:20:55 +0800
committerGravatar GitHub <noreply@github.com> 2022-07-12 20:20:55 +0800
commit749b028ca9591155cdcfce5226fbb615796cc625 (patch)
tree69d57882be3529ecf2456e2c2b29689eb1557ad5 /source/features/patch-diff-links.tsx
parentdb2fcb7e6e2346d57759a9849d844195e9698b1c (diff)
downloadrefined-github-749b028ca9591155cdcfce5226fbb615796cc625.tar.gz
refined-github-749b028ca9591155cdcfce5226fbb615796cc625.tar.zst
refined-github-749b028ca9591155cdcfce5226fbb615796cc625.zip
Improve reliability of `patch-diff-links` (#5817)
Diffstat (limited to 'source/features/patch-diff-links.tsx')
-rw-r--r--source/features/patch-diff-links.tsx4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/features/patch-diff-links.tsx b/source/features/patch-diff-links.tsx
index 1c434a3c..79d2ce25 100644
--- a/source/features/patch-diff-links.tsx
+++ b/source/features/patch-diff-links.tsx
@@ -3,10 +3,12 @@ import select from 'select-dom';
import * as pageDetect from 'github-url-detection';
import features from '.';
+import {getCleanPathname} from '../github-helpers';
function init(): void {
- let commitUrl = location.pathname.replace(/\/$/, '');
+ let commitUrl = '/' + getCleanPathname();
+ // Avoids a redirection
if (pageDetect.isPRCommit()) {
commitUrl = commitUrl.replace(/\/pull\/\d+\/commits/, '/commit');
}