BigW Consortium Gitlab

Commit 3bf06866 by Grzegorz Bizon Committed by Michael Kozono

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 (cherry picked from commit 3dcdd4a1) 3bff85a4 Fix the writing of invalid environment refs
parent 73e40d75
......@@ -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
......
---
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 }
......
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