Commit 96a49c79 authored by Robert Schilling's avatar Robert Schilling

API: Support dots in wiki slugs

parent 2abbfda3
---
title: 'API: Support dots in wiki slugs'
merge_request: 24383
author: Robert Schilling
type: fixed
...@@ -22,7 +22,9 @@ module API ...@@ -22,7 +22,9 @@ module API
end end
end end
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do WIKI_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(slug: API::NO_SLASH_URL_PART_REGEX)
resource :projects, requirements: WIKI_ENDPOINT_REQUIREMENTS do
desc 'Get a list of wiki pages' do desc 'Get a list of wiki pages' do
success Entities::WikiPageBasic success Entities::WikiPageBasic
end end
...@@ -103,7 +105,7 @@ module API ...@@ -103,7 +105,7 @@ module API
requires :file, type: ::API::Validations::Types::SafeFile, desc: 'The attachment file to be uploaded' requires :file, type: ::API::Validations::Types::SafeFile, desc: 'The attachment file to be uploaded'
optional :branch, type: String, desc: 'The name of the branch' optional :branch, type: String, desc: 'The name of the branch'
end end
post ":id/wikis/attachments", requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do post ":id/wikis/attachments" do
authorize! :create_wiki, user_project authorize! :create_wiki, user_project
result = ::Wikis::CreateAttachmentService.new(user_project, result = ::Wikis::CreateAttachmentService.new(user_project,
......
...@@ -5,7 +5,7 @@ FactoryBot.define do ...@@ -5,7 +5,7 @@ FactoryBot.define do
transient do transient do
attrs do attrs do
{ {
title: 'Title', title: 'Title.with.dot',
content: 'Content for wiki page', content: 'Content for wiki page',
format: 'markdown' format: 'markdown'
} }
......
...@@ -22,7 +22,7 @@ describe API::Wikis do ...@@ -22,7 +22,7 @@ describe API::Wikis do
context 'when wiki has pages' do context 'when wiki has pages' do
let!(:pages) do let!(:pages) do
[create(:wiki_page, wiki: project_wiki, attrs: { title: 'page1', content: 'content of page1' }), [create(:wiki_page, wiki: project_wiki, attrs: { title: 'page1', content: 'content of page1' }),
create(:wiki_page, wiki: project_wiki, attrs: { title: 'page2', content: 'content of page2' })] create(:wiki_page, wiki: project_wiki, attrs: { title: 'page2.with.dot', content: 'content of page2' })]
end end
it 'returns the list of wiki pages without content' do it 'returns the list of wiki pages without content' 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