Snippet invalid_path for file name error
Summary
Since the introduction of versioned snippets, there is currently a problem if a Snippet has a filename that will result in an invalid git path, e.g. using http://test.my.url:3000/breaks/things.
The error is raised within Gitaly (via the Rugged gem) and has three different impacts which we need to address:
1. Creating Snippets:
Creating a Snippet in the GitLab UI this results in an "invalid path: http://test.my.url:3000/breaks/things" error being displayed to the user
2. Updating Snippets:
A generic "Error updating the snippet" message is displayed when updating an existing Snippet
3. Migrating Snippets to versioned:
Migration of existing Snippets in the backfill migration fails in this scenario
What we need to do
We can potentially address these issues in the following way:
-
Creating Snippets - catch the error and display a more friendly message, e.g.
Invalid file name used -
Updating Snippets - catch this error and return a useful message to the user so they know what they have to address to proceed
-
Migrating Snippets - catch this error and
parameterize(or some other equivalent?) the file name so that it becomes valid and the migration can succeed.
This can be handled in two separate MRs, one for create/update and the other for the migration with the priority being the migration solution due to it's current impact.
Steps to reproduce
Create or update an existing snippet accordingly, with the file name http://test.my.url:3000/breaks/things
What is the current bug behavior?
- Renders message from Gitaly/Rugged
- Unhelpful message delivered to users
- Migration fails
What is the expected correct behavior?
- Appropriate message used
- Appropriate message used
- Migration succeeds
