diff options
Diffstat (limited to 'app/assets/javascripts/blob/blob_line_permalink_updater.js')
-rw-r--r-- | app/assets/javascripts/blob/blob_line_permalink_updater.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/assets/javascripts/blob/blob_line_permalink_updater.js b/app/assets/javascripts/blob/blob_line_permalink_updater.js index df38c5400e2..928035d7c1e 100644 --- a/app/assets/javascripts/blob/blob_line_permalink_updater.js +++ b/app/assets/javascripts/blob/blob_line_permalink_updater.js @@ -1,4 +1,5 @@ import { getLocationHash } from '../lib/utils/url_utility'; +import { getPageParamValue, getPageSearchString } from './utils'; const lineNumberRe = /^(L|LC)[0-9]+/; @@ -16,7 +17,10 @@ const updateLineNumbersOnBlobPermalinks = (linksToUpdate) => { permalinkButton.dataset.originalHref = href; return href; })(); - permalinkButton.setAttribute('href', `${baseHref}${hashUrlString}`); + const lineNum = parseInt(hash.split('L')[1], 10); + const page = getPageParamValue(lineNum); + const searchString = getPageSearchString(baseHref, page); + permalinkButton.setAttribute('href', `${baseHref}${searchString}${hashUrlString}`); }); } }; |