Skip to content

Fix the error when the fork is linked to itself

Vasilii Iakliushin requested to merge 346563_fix_self_fork_case into master

What does this MR do and why?

Contributes to #346563 (closed)

Problem

There is no validation for the case when the project is linked to itself. It leads to 500 error.

Solution

Check this case and respond with an error.

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

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
{"message":"500 Internal Server Error"}% {"message":"Target project cannot be equal to source project"}%

How to set up and validate locally

  1. curl -X POST -H 'PRIVATE-TOKEN: <YOUR-TOKEN>' 'http://127.0.0.1:3000/api/v4/projects/1/fork/1'
  2. You should see 400 error instead of 500 error.
Edited by Vasilii Iakliushin

Merge request reports

Loading