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
a50bb2f2
Commit
a50bb2f2
authored
Jun 02, 2019
by
Nick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: replace spaces in upload filenames
parent
b38655b9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
editor-modal-media.vue
client/components/editor/editor-modal-media.vue
+2
-2
upload.js
server/controllers/upload.js
+3
-1
asset.js
server/graph/resolvers/asset.js
+1
-1
No files found.
client/components/editor/editor-modal-media.vue
View file @
a50bb2f2
...
...
@@ -10,9 +10,9 @@
.body-2(:class='$vuetify.dark ? `white--text` : `teal--text`') Assets
v-spacer
v-btn(flat, icon, @click='refresh')
v-icon
cached
v-icon
(:color='$vuetify.dark ? `white` : `teal`') refresh
v-dialog(v-model='newFolderDialog', max-width='550')
v-btn.my-0.mr-0.radius-7(outline, large, color='teal', :icon='$vuetify.breakpoint.xsOnly', slot='activator')
v-btn.m
l-3.m
y-0.mr-0.radius-7(outline, large, color='teal', :icon='$vuetify.breakpoint.xsOnly', slot='activator')
v-icon(:left='$vuetify.breakpoint.mdAndUp') add
span.hidden-sm-and-down(:class='$vuetify.dark ? `teal--text text--lighten-3` : ``') New Folder
v-card.wiki-form
...
...
server/controllers/upload.js
View file @
a50bb2f2
...
...
@@ -73,6 +73,9 @@ router.post('/u', multer({
}
}
// Sanitize filename
fileMeta
.
originalname
=
sanitize
(
fileMeta
.
originalname
.
toLowerCase
().
replace
(
/
[\s
,;
]
+/g
,
'_'
))
// Check if user can upload at path
const
assetPath
=
(
folderId
)
?
hierarchy
.
map
(
h
=>
h
.
slug
).
join
(
'/'
)
+
`/
${
fileMeta
.
originalname
}
`
:
fileMeta
.
originalname
if
(
!
WIKI
.
auth
.
checkAccess
(
req
.
user
,
[
'write:assets'
],
{
path
:
assetPath
}))
{
...
...
@@ -85,7 +88,6 @@ router.post('/u', multer({
// Process upload file
await
WIKI
.
models
.
assets
.
upload
({
...
fileMeta
,
originalname
:
sanitize
(
fileMeta
.
originalname
).
toLowerCase
(),
folderId
:
folderId
,
assetPath
,
userId
:
req
.
user
.
id
...
...
server/graph/resolvers/asset.js
View file @
a50bb2f2
...
...
@@ -42,7 +42,7 @@ module.exports = {
try
{
const
folderSlug
=
sanitize
(
args
.
slug
).
toLowerCase
()
const
parentFolderId
=
args
.
parentFolderId
===
0
?
null
:
args
.
parentFolderId
const
result
=
await
WIKI
.
models
.
assetFolders
.
query
().
where
({
const
result
=
await
WIKI
.
models
.
assetFolders
.
query
().
where
({
parentId
:
parentFolderId
,
slug
:
folderSlug
}).
first
()
...
...
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