Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
95535aa3
Commit
95535aa3
authored
Oct 02, 2019
by
Nick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: prevent dots and spaces in page path during create
parent
2e0f861f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
error.js
server/helpers/error.js
+4
-0
pages.js
server/models/pages.js
+4
-0
No files found.
server/helpers/error.js
View file @
95535aa3
...
...
@@ -129,6 +129,10 @@ module.exports = {
message
:
'Page content cannot be empty.'
,
code
:
6004
}),
PageIllegalPath
:
CustomError
(
'PageIllegalPath'
,
{
message
:
'Page path cannot contains illegal characters.'
,
code
:
6005
}),
PageNotFound
:
CustomError
(
'PageNotFound'
,
{
message
:
'This page does not exist.'
,
code
:
6003
...
...
server/models/pages.js
View file @
95535aa3
...
...
@@ -213,6 +213,10 @@ module.exports = class Page extends Model {
* @returns {Promise} Promise of the Page Model Instance
*/
static
async
createPage
(
opts
)
{
if
(
opts
.
path
.
indexOf
(
'.'
)
>=
0
||
opts
.
path
.
indexOf
(
' '
)
>=
0
)
{
throw
new
WIKI
.
Error
.
PageIllegalPath
()
}
const
dupCheck
=
await
WIKI
.
models
.
pages
.
query
().
select
(
'id'
).
where
(
'localeCode'
,
opts
.
locale
).
where
(
'path'
,
opts
.
path
).
first
()
if
(
dupCheck
)
{
throw
new
WIKI
.
Error
.
PageDuplicateCreate
()
...
...
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