Fix 500 error when namespace path is a negative integer
What does this MR do and why?
- Contributes to #339606 (closed)
- Sentry error: https://sentry.gitlab.net/gitlab/gitlabcom/issues/3333735
Problem
Negative integer is provided to PG lower
function that does not
support integers.
PG::UndefinedFunction: ERROR: function lower(integer) does not exist
Solution
- Adjust Regex to handle negative integers
- Explicitly convert
path
to string type
How to set up and validate locally
- Create a project fork with Rest API
curl -X POST -H "PRIVATE-TOKEN: _TOKEN_" "http://127.0.0.1:3000/api/v4/projects/1/fork?namespace_id=-1"
- You should not see a 500 error
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.