Error creating Wikis/Snippet repositories when the default branch name contains non ascii chars
Summary
We are unable to create wikis when the instance wide default branch name contains non ascii chars.
This also applies to create snippets as they also rely on the default branch name when creating a snippet repo.
Discovered when doing some testing related to #393400 (closed)
Steps to reproduce
Wikis
- Set an instance level custom initial branch name that contains some non ascii text e.g.
mäin- https://docs.gitlab.com/ee/user/project/repository/branches/default.html#instance-level-custom-initial-branch-name
- This doesn't impact group level custom branch names, as the wiki service takes the instance wide default value for it's default branch
- Create a new project
- When using the UI in GDK, you will get an error
Wiki::CouldNotCreateWikiError
Snippets
- Use an existing project, and access the project snippets
- Attempt to create a new snippet.
- Note the error
Can't create snippet: Repository Error creating the snippet - U+00E4 from UTF-8 to ASCII-8BIT
What is the current bug behavior?
- Error in GDK UI -
errorWiki::CouldNotCreateWikiError` - Wiki project isn't created
- Error trying to create a first new snippet in a project
- Snippets repo isn't created
What is the expected correct behavior?
When the instance wide default branch contains non ascii chars
- Should be able to create a project and wiki
- Should be able to create snippets
Possible fixes
- Error raised from https://gitlab.com/gitlab-org/gitlab/-/blob/142546418dccbd29e9eb6bc8b85179d99d2a5cd5/app/models/wiki.rb#L185
- Should be able to resolve by using
encode_binaryon thedefault_branchparam in https://gitlab.com/gitlab-org/gitlab/-/blob/19c7c11f71350f99b3b8505fd29e9718175a7c0d/lib/gitlab/gitaly_client/repository_service.rb#L112
Edited by John McDonnell