Commit f6eed567 authored by Stan Hu's avatar Stan Hu

Merge branch 'fix-branch-dot-txt' into 'master'

Fix API requests for branch names ending in .txt

Closes #217097

See merge request gitlab-org/gitlab!31446
parents 2e37f6a0 39c7cae9
---
title: Fix API requests for branch names ending in .txt
merge_request: 31446
author: Daniel Stone
type: fixed
......@@ -8,6 +8,8 @@ module API
BRANCH_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(branch: API::NO_SLASH_URL_PART_REGEX)
after_validation { content_type "application/json" }
before do
require_repository_enabled!
authorize! :download_code, user_project
......
......@@ -16,6 +16,7 @@ describe API::Branches do
before do
project.add_maintainer(user)
project.repository.add_branch(user, 'ends-with.txt', branch_sha)
end
describe "GET /projects/:id/repository/branches" do
......@@ -240,6 +241,12 @@ describe API::Branches do
it_behaves_like 'repository branch'
end
context 'when branch contains dot txt' do
let(:branch_name) { project.repository.find_branch('ends-with.txt').name }
it_behaves_like 'repository branch'
end
context 'when branch contains a slash' do
let(:branch_name) { branch_with_slash.name }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment