Permalink button drops the `#LXX` URL parameter if the "link" icon is clicked instead of the line number

Summary

When viewing a file, clicking the "Permalink" button will cause the previously-selected line reference (e.g. #L32) to be dropped from the URL. This happens when the user selects a line by clicking the "link" icon instead of the actual line number.

Steps to reproduce

  1. Navigate to a file view, i.e. https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/views/shared/milestones/_sidebar.html.haml
  2. Select a specific line by clicking on the link icon next to the line number. Notice that a URL parameter like #LXX has been appended to the current URL in your browser's address bar.
  3. Click the "Permalink" button

What is the current bug behavior?

The new URL no longer includes the #LXX parameter.

What is the expected correct behavior?

The new URL should still contain the #LXX parameter that existed before the "Permalink" button was clicked, regardless if the line was selected by clicking the "link" icon or the actual line number.

GIF

2020-01-20_08.49.47

Output of checks

This bug happens on GitLab.com.

Edited Jan 24, 2020 by Nathan Friend
Assignee Loading
Time tracking Loading