Construct repository links for nonextant targets same as for extant ones
What does this MR do and why?
Construct repository links for nonextant targets same as for extant ones
We'll always call them blobs, but that's fine --- they don't exist anyway. The point is that the links we produce are predictable, and will trigger a nice "'file' did not exist on 'ref'" message and redirect back to the repo root, instead of producing a hard "404: Page not found" because it didn't match a route (current behaviour).
References
See #590919 (closed) (this MR shall close that issue), and #590919 (comment 3107565260) for analysis/decision on how to fix.
How to set up and validate locally
- Create a file in a repository called
abc/def/ghi.md. In it, writeHello [world](../../world.md). Don't have a file calledworld.mdat the root of the repository, that'd spoil the repro! - Look at the rendered
worldlink. It should be something likehttp://gdk.test:3000/your/repo/-/world.md. This isn't a valid GitLab URL! - Click it! You should see a "404: Page not found" page.
- Check this branch out.
- Maybe restart your GDK if you're feeling unlucky.
- Go back to
ghi.mdand edit its content; changeHellotoHowdyor similar. (We want to make sure there's no cache in the way.) - Look at the rendered
worldlink now. It should be something likehttp://gdk.test:3000/your/repo/-/blob/main/world.md. This is a valid GitLab URL! - Click it. You should be redirected to the repository root page, with a pop-up error that says '"world.md" did not exist on "main"'.
- This is the way.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.