Branches with names containing URL encoded spaces can't be deleted

Summary

Creating a branch with %20 characters in the title leads to a branch that cannot later be deleted.

Steps to reproduce

In a project, create a branch Test%2520HTML-Encoded%2520Branch (Results in a branch Test%20HTML-Encoded%20Branch) Attempt to delete it.

Example Project

https://gitlab.com/lyle/super-simple-ci/tree/Test%2520HTML-Encoded%2520Branch

What is the current bug behavior?

An undeletable branch is created

What is the expected correct behavior?

A branch we can delete is created

Relevant logs and/or screenshots

https://sentry.gitlap.com/gitlab/gitlabcom/issues/175573/

GRPC::Unknown: 2:cannot locate local branch 'PM Source 5'
  grpc/generic/active_call.rb:31:in `check_status'
    fail GRPC::BadStatus.new_status_exception(
  grpc/generic/active_call.rb:180:in `attach_status_results_and_complete_call'
    recv_status_batch_result.check_status
  grpc/generic/active_call.rb:372:in `request_response'
    attach_status_results_and_complete_call(batch_result)
  grpc/generic/client_stub.rb:178:in `block in request_response'
    c.request_response(req, metadata: metadata)
  grpc/generic/interceptors.rb:170:in `intercept!'
    return yield if @interceptors.none?
...
(149 additional frame(s) were not displayed)

Gitlab::Git::CommandError: 2:cannot locate local branch 'PM Source 5'
  gitlab/git/repository.rb:1376:in `rescue in gitaly_migrate'
    raise CommandError.new(e)
  gitlab/git/repository.rb:1369:in `gitaly_migrate'
    def gitaly_migrate(method, status: Gitlab::GitalyClient::MigrationStatus::OPT_IN, &block)
  gitlab/git/repository.rb:190:in `find_branch'
    gitaly_migrate(:find_branch) do |is_enabled|
  repository.rb:176:in `find_branch'
    raw_repository.find_branch(name, fresh_repo)
  gitlab/metrics/instrumentation.rb:159:in `block in find_branch'
    .measure { super }
...
(135 additional frame(s) were not displayed)

Gitlab::Git::CommandError: 2:cannot locate local branch 'PM Source 5'

Output of checks

This bug happens on GitLab.com

Edited Sep 02, 2020 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading