Commit 1fb7a93d authored by Sean McGivern's avatar Sean McGivern

Merge branch...

Merge branch '39119-actioncontroller-urlgenerationerror-no-route-matches-action-evidence-controller-projects' into 'master'

Allow slashes in release tags

Closes #39119

See merge request gitlab-org/gitlab!22527
parents 1311393d b9383217
...@@ -40,7 +40,7 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated ...@@ -40,7 +40,7 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated
def evidence_file_path def evidence_file_path
return unless release.evidence.present? return unless release.evidence.present?
evidence_project_release_url(project, tag, format: :json) evidence_project_release_url(project, release.to_param, format: :json)
end end
private private
......
---
title: Fix releases page when tag contains a slash
merge_request: 22527
author:
type: fixed
...@@ -57,4 +57,14 @@ describe 'User views releases', :js do ...@@ -57,4 +57,14 @@ describe 'User views releases', :js do
expect(page).to have_content('Upcoming Release') expect(page).to have_content('Upcoming Release')
end end
end end
context 'with a tag containing a slash' do
it 'sees the release' do
release = create :release, :with_evidence, project: project, tag: 'debian/2.4.0-1'
visit project_releases_path(project)
expect(page).to have_content(release.name)
expect(page).to have_content(release.tag)
end
end
end end
...@@ -96,4 +96,28 @@ describe ReleasePresenter do ...@@ -96,4 +96,28 @@ describe ReleasePresenter do
it { is_expected.to be_nil } it { is_expected.to be_nil }
end end
end end
describe '#evidence_file_path' do
subject { presenter.evidence_file_path }
context 'without evidence' do
it { is_expected.to be_falsy }
end
context 'with evidence' do
let(:release) { create :release, :with_evidence, project: project }
specify do
is_expected.to match /#{evidence_project_release_url(project, release.tag, format: :json)}/
end
end
context 'when a tag contains a slash' do
let(:release) { create :release, :with_evidence, project: project, tag: 'debian/2.4.0-1' }
specify do
is_expected.to match /#{evidence_project_release_url(project, CGI.escape(release.tag), format: :json)}/
end
end
end
end end
...@@ -115,6 +115,16 @@ describe API::Releases do ...@@ -115,6 +115,16 @@ describe API::Releases do
end end
end end
context 'when tag contains a slash' do
let!(:release) { create(:release, project: project, tag: 'debian/2.4.0-1', description: "debian/2.4.0-1") }
it 'returns 200 HTTP status' do
get api("/projects/#{project.id}/releases", maintainer)
expect(response).to have_gitlab_http_status(:ok)
end
end
context 'when user is a guest' do context 'when user is a guest' do
let!(:release) do let!(:release) do
create(:release, create(:release,
......
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