Skip to content

Fix for creating a project through API when import_url is nil

Toon Claes requested to merge tc-fix-project-create-500 into master

What does this MR do?

The API was returning 500 when nil is passed for the import_url.

In fact, it was Gitlab::UrlSanitizer.valid? which was throwing a NoMethodError when nil value was passed.

To reproduce the issue:

curl --header "PRIVATE-TOKEN: mytoken" --request POST \
     -H "Content-Type: application/json" \
     -d '{"namespace_id": "1", "name": "my-name", "import_url": null}' \
     'http://gitlab.my.site/api/v3/projects'| jq

Are there points in the code the reviewer needs to double check?

Not sure if it should be Pick into Stable ?

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #29121 (closed)

Merge request reports