diff --git a/app/assets/javascripts/pages/projects/project.js b/app/assets/javascripts/pages/projects/project.js index ef6953db83b2570e7109514e28e86c0aba635690..7bb740465c80aeb6c800ded0ee4ed858bcc64ae8 100644 --- a/app/assets/javascripts/pages/projects/project.js +++ b/app/assets/javascripts/pages/projects/project.js @@ -126,8 +126,9 @@ export default class Project { const refs = this.fullData.Branches.concat(this.fullData.Tags); const currentRef = refs.find((ref) => loc.indexOf(ref) > -1); if (currentRef) { - const targetPath = loc.split(currentRef)[1].slice(1); + const targetPath = loc.split(currentRef)[1].slice(1).split('#')[0]; selectedUrl.searchParams.set('path', targetPath); + selectedUrl.hash = window.location.hash; } } diff --git a/changelogs/unreleased/296667-fix-branch-change-with-line-selected.yml b/changelogs/unreleased/296667-fix-branch-change-with-line-selected.yml new file mode 100644 index 0000000000000000000000000000000000000000..f42e04a193c88c5771c05ce6d30e62a2b0d11b2f --- /dev/null +++ b/changelogs/unreleased/296667-fix-branch-change-with-line-selected.yml @@ -0,0 +1,5 @@ +--- +title: Fix bug branch change with line selected +merge_request: 52285 +author: +type: fixed