Skip to content

Fix 404 when clicking 'Cancel' from fork project

What does this MR do and why?

Currently clicking 'Cancel' from the 'Fork Project' page results in a 404.

This is because the href on the 'Cancel' button back to the project page is considered a relative link because it does not begin with / and so resolves to something like /namespace1/project1/-/forks/namespace1/project1 instead of /namespace1/project1.

This change resolves this by providing cancelPath to the cancel button component using the Rails path helper for the project instead of Project#full_path. The Rails path helper prefixes the path with '/', Project#full_path doesn't.

Screenshots or screen recordings

Before

fork_cancel_before

After

fork_cancel_after

How to set up and validate locally

  1. Click 'Fork' on a project
  2. Click 'Cancel'
  3. Verify that you are redirected back to the original project page

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #378502 (closed)

Edited by Malcolm Locke

Merge request reports

Loading