Merge branch 'sh-fix-environment-write-ref' into 'master'
Fix the writing of invalid environment refs Closes #39182 See merge request gitlab-org/gitlab-ce!14993
This commit is contained in:
commit
3dcdd4a1e8
|
@ -110,7 +110,7 @@ class Environment < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def ref_path
|
||||
"refs/#{Repository::REF_ENVIRONMENTS}/#{Shellwords.shellescape(name)}"
|
||||
"refs/#{Repository::REF_ENVIRONMENTS}/#{generate_slug}"
|
||||
end
|
||||
|
||||
def formatted_external_url
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Fix the writing of invalid environment refs
|
||||
merge_request:
|
||||
author:
|
||||
type: fixed
|
|
@ -575,6 +575,16 @@ describe Environment do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#ref_path' do
|
||||
subject(:environment) do
|
||||
create(:environment, name: 'staging / review-1')
|
||||
end
|
||||
|
||||
it 'returns a path that uses the slug and does not have spaces' do
|
||||
expect(environment.ref_path).to start_with('refs/environments/staging-review-1-')
|
||||
end
|
||||
end
|
||||
|
||||
describe '#external_url_for' do
|
||||
let(:source_path) { 'source/file.html' }
|
||||
let(:sha) { RepoHelpers.sample_commit.id }
|
||||
|
|
Loading…
Reference in New Issue