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
e4efb38f
Unverified
Commit
e4efb38f
authored
May 28, 2023
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: empty duplicate alias warning on page udpate
parent
1522b269
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
pages.mjs
server/models/pages.mjs
+8
-7
No files found.
server/models/pages.mjs
View file @
e4efb38f
...
...
@@ -477,13 +477,14 @@ export class Page extends Model {
throw
new
Error
(
'ERR_PAGE_ALIAS_TOO_LONG'
)
}
else
if
(
!
aliasRegex
.
test
(
patch
.
alias
))
{
throw
new
Error
(
'ERR_PAGE_INVALID_ALIAS'
)
}
const
dupAliasCheck
=
await
WIKI
.
db
.
pages
.
query
().
where
({
siteId
:
ogPage
.
siteId
,
alias
:
patch
.
alias
}).
andWhereNot
(
'id'
,
ogPage
.
id
).
select
(
'id'
).
first
()
if
(
dupAliasCheck
)
{
throw
new
Error
(
'ERR_PAGE_DUPLICATE_ALIAS'
)
}
else
if
(
patch
.
alias
.
length
>
0
)
{
const
dupAliasCheck
=
await
WIKI
.
db
.
pages
.
query
().
where
({
siteId
:
ogPage
.
siteId
,
alias
:
patch
.
alias
}).
andWhereNot
(
'id'
,
ogPage
.
id
).
select
(
'id'
).
first
()
if
(
dupAliasCheck
)
{
throw
new
Error
(
'ERR_PAGE_DUPLICATE_ALIAS'
)
}
}
}
...
...
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