Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9d799cca
Commit
9d799cca
authored
May 09, 2018
by
Ahmad Sherif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix finding wiki pages when they have invalidly-encoded content
Fixes #43715
parent
1802954b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
1 deletion
+31
-1
GITALY_SERVER_VERSION
GITALY_SERVER_VERSION
+1
-1
changelogs/unreleased/fix-wiki-find-page-invalid-encoding.yml
...gelogs/unreleased/fix-wiki-find-page-invalid-encoding.yml
+5
-0
config/initializers/gollum.rb
config/initializers/gollum.rb
+14
-0
spec/models/project_wiki_spec.rb
spec/models/project_wiki_spec.rb
+11
-0
No files found.
GITALY_SERVER_VERSION
View file @
9d799cca
0.
99
.0
0.
100
.0
changelogs/unreleased/fix-wiki-find-page-invalid-encoding.yml
0 → 100644
View file @
9d799cca
---
title
:
Fix finding wiki pages when they have invalidly-encoded content
merge_request
:
18856
author
:
type
:
fixed
config/initializers/gollum.rb
View file @
9d799cca
...
@@ -7,6 +7,20 @@ module Gollum
...
@@ -7,6 +7,20 @@ module Gollum
end
end
require
"gollum-lib"
require
"gollum-lib"
module
Gollum
class
Page
def
text_data
(
encoding
=
nil
)
data
=
if
raw_data
.
respond_to?
(
:encoding
)
raw_data
.
force_encoding
(
encoding
||
Encoding
::
UTF_8
)
else
raw_data
end
Gitlab
::
EncodingHelper
.
encode!
(
data
)
end
end
end
Rails
.
application
.
configure
do
Rails
.
application
.
configure
do
config
.
after_initialize
do
config
.
after_initialize
do
Gollum
::
Page
.
per_page
=
Kaminari
.
config
.
default_per_page
Gollum
::
Page
.
per_page
=
Kaminari
.
config
.
default_per_page
...
...
spec/models/project_wiki_spec.rb
View file @
9d799cca
...
@@ -159,6 +159,17 @@ describe ProjectWiki do
...
@@ -159,6 +159,17 @@ describe ProjectWiki do
expect
(
page
.
title
).
to
eq
(
"autre pagé"
)
expect
(
page
.
title
).
to
eq
(
"autre pagé"
)
end
end
end
end
context
'pages with invalidly-encoded content'
do
before
do
create_page
(
"encoding is fun"
,
"f
\xFC
r"
.
b
)
end
it
"can find the page"
do
page
=
subject
.
find_page
(
"encoding is fun"
)
expect
(
page
.
content
).
to
eq
(
"fr"
)
end
end
end
end
context
'when Gitaly wiki_find_page is enabled'
do
context
'when Gitaly wiki_find_page is enabled'
do
...
...
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