Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
projects.thm.de
GitLab
Commits
3143edfe
Commit
3143edfe
authored
Apr 07, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug where Wiki pages that include a '/' were no longer accessible
Closes #1363
parent
7feec5fe
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
88 additions
and
1 deletion
+88
-1
CHANGELOG
CHANGELOG
+1
-0
app/controllers/projects/wikis_controller.rb
app/controllers/projects/wikis_controller.rb
+5
-1
app/helpers/wiki_helper.rb
app/helpers/wiki_helper.rb
+22
-0
features/project/wiki.feature
features/project/wiki.feature
+24
-0
features/steps/project/wiki.rb
features/steps/project/wiki.rb
+36
-0
No files found.
CHANGELOG
View file @
3143edfe
Please view this file on the master branch, on stable branches it's out of date.
v 7.10.0 (unreleased)
- Fix bug where Wiki pages that included a '/' were no longer accessible (Stan Hu)
- Fix bug where error messages from Dropzone would not be displayed on the issues page (Stan Hu)
- Add ability to configure Reply-To address in gitlab.yml (Stan Hu)
- Fix broken side-by-side diff view on merge request page (Stan Hu)
...
...
app/controllers/projects/wikis_controller.rb
View file @
3143edfe
...
...
@@ -5,6 +5,7 @@ class Projects::WikisController < Projects::ApplicationController
before_filter
:authorize_write_wiki!
,
only:
[
:edit
,
:create
,
:history
]
before_filter
:authorize_admin_wiki!
,
only: :destroy
before_filter
:load_project_wiki
include
WikiHelper
def
pages
@wiki_pages
=
Kaminari
.
paginate_array
(
@project_wiki
.
pages
).
page
(
params
[
:page
]).
per
(
PER_PAGE
)
...
...
@@ -45,7 +46,10 @@ def update
return
render
(
'empty'
)
unless
can?
(
current_user
,
:write_wiki
,
@project
)
if
@page
.
update
(
content
,
format
,
message
)
redirect_to
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@page
],
notice:
'Wiki was successfully updated.'
redirect_to
(
namespace_project_wiki_path
(
@project
.
namespace
,
@project
,
@page
),
notice:
'Wiki was successfully updated.'
)
else
render
'edit'
end
...
...
app/helpers/wiki_helper.rb
0 → 100644
View file @
3143edfe
module
WikiHelper
# Rails v4.1.9+ escapes all model IDs, converting slashes into %2F. The
# only way around this is to implement our own path generators.
def
namespace_project_wiki_path
(
namespace
,
project
,
wiki_page
,
*
args
)
slug
=
case
wiki_page
when
Symbol
wiki_page
else
wiki_page
.
slug
end
namespace_project_path
(
namespace
,
project
)
+
"/wikis/
#{
slug
}
"
end
def
edit_namespace_project_wiki_path
(
namespace
,
project
,
wiki_page
,
*
args
)
namespace_project_wiki_path
(
namespace
,
project
,
wiki_page
)
+
'/edit'
end
def
history_namespace_project_wiki_path
(
namespace
,
project
,
wiki_page
,
*
args
)
namespace_project_wiki_path
(
namespace
,
project
,
wiki_page
)
+
'/history'
end
end
features/project/wiki.feature
View file @
3143edfe
...
...
@@ -62,3 +62,27 @@ Feature: Project Wiki
And
I browse to wiki page with images
And
I click on image link
Then
I should see the new wiki page form
@javascript
Scenario
:
New Wiki page that has a path
Given
I create a New page with paths
And
I click on the
"Pages"
button
Then
I should see non-escaped link in the pages list
@javascript
Scenario
:
Edit Wiki page that has a path
Given
I create a New page with paths
And
I click on the
"Pages"
button
And
I edit the Wiki page with a path
Then
I should see a non-escaped path
And
I should see the Editing page
And
I change the content
Then
I should see the updated content
@javascript
Scenario
:
View the page history of a Wiki page that has a path
Given
I create a New page with paths
And
I click on the
"Pages"
button
And
I view the page history of a Wiki page that has a path
Then
I should see a non-escaped path
And
I should see the page history
features/steps/project/wiki.rb
View file @
3143edfe
...
...
@@ -3,6 +3,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
include
SharedProject
include
SharedNote
include
SharedPaths
include
WikiHelper
step
'I click on the Cancel button'
do
within
(
:css
,
".form-actions"
)
do
...
...
@@ -123,6 +124,41 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
page
.
should
have_content
(
'Editing - image.jpg'
)
end
step
'I create a New page with paths'
do
click_on
'New Page'
fill_in
'Page slug'
,
with:
'one/two/three'
click_on
'Build'
fill_in
"wiki_content"
,
with:
'wiki content'
click_on
"Create page"
current_path
.
should
include
'one/two/three'
end
step
'I should see non-escaped link in the pages list'
do
page
.
should
have_xpath
(
"//a[@href='/
#{
project
.
path_with_namespace
}
/wikis/one/two/three']"
)
end
step
'I edit the Wiki page with a path'
do
click_on
'three'
click_on
'Edit'
end
step
'I should see a non-escaped path'
do
current_path
.
should
include
'one/two/three'
end
step
'I should see the Editing page'
do
page
.
should
have_content
(
'Editing'
)
end
step
'I view the page history of a Wiki page that has a path'
do
click_on
'three'
click_on
'Page History'
end
step
'I should see the page history'
do
page
.
should
have_content
(
'History for'
)
end
def
wiki
@project_wiki
=
ProjectWiki
.
new
(
project
,
current_user
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment