Commit 45976540 authored by Mark Fletcher's avatar Mark Fletcher

Fix archive prefix bug for refs containing dots

parent 68e64a5b
---
title: Fix archive prefix bug for refs containing dots
merge_request:
author:
...@@ -201,7 +201,7 @@ module Gitlab ...@@ -201,7 +201,7 @@ module Gitlab
def archive_prefix(ref, sha) def archive_prefix(ref, sha)
project_name = self.name.chomp('.git') project_name = self.name.chomp('.git')
"#{project_name}-#{ref.parameterize}-#{sha}" "#{project_name}-#{ref.tr('/', '-')}-#{sha}"
end end
def archive_metadata(ref, storage_path, format = "tar.gz") def archive_metadata(ref, storage_path, format = "tar.gz")
......
...@@ -90,6 +90,12 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -90,6 +90,12 @@ describe Gitlab::Git::Repository, seed_helper: true do
expect(prefix).to eq("#{project_name}-test-branch-SHA") expect(prefix).to eq("#{project_name}-test-branch-SHA")
end end
it 'returns correct string for a ref containing dots' do
prefix = repository.archive_prefix('test.branch', 'SHA')
expect(prefix).to eq("#{project_name}-test.branch-SHA")
end
end end
describe '#archive' do describe '#archive' do
......
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