Fix for creating a project through API when import_url is nil
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?
-
Changelog entry added -
Documentation created/updated -
API support added - Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together
What are the relevant issue numbers?
Closes #29121 (closed)