Prevent error when adding line references if there isn't a matching target line
What does this MR do and why?
For #519154 (closed)
Fixes an issue when Linked Files and a line_code URL fragment are used together that causes an uncaught fatal error when attempting to add line references.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
| Before | After |
|---|---|
| Screencast_from_2025-02-13_17-09-40 | Screencast_from_2025-02-13_17-07-29 |
How to set up and validate locally
See the linked issue for full replication steps.
Truncated replication steps:
- Visit a diff using both a
line_codeURL fragment and the Linked File feature (?file=[sha])- Your URL should look something like
https://gdk.test:3443/ns/project/-/merge_requests/1/diffs?file=[sha]#[same sha]_[line number]_[line_number]
- Your URL should look something like
Edited by Thomas Randolph