fix: replace spaces in upload filenames
This commit is contained in:
parent
b38655b91c
commit
a50bb2f281
@ -10,9 +10,9 @@
|
|||||||
.body-2(:class='$vuetify.dark ? `white--text` : `teal--text`') Assets
|
.body-2(:class='$vuetify.dark ? `white--text` : `teal--text`') Assets
|
||||||
v-spacer
|
v-spacer
|
||||||
v-btn(flat, icon, @click='refresh')
|
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-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.ml-3.my-0.mr-0.radius-7(outline, large, color='teal', :icon='$vuetify.breakpoint.xsOnly', slot='activator')
|
||||||
v-icon(:left='$vuetify.breakpoint.mdAndUp') add
|
v-icon(:left='$vuetify.breakpoint.mdAndUp') add
|
||||||
span.hidden-sm-and-down(:class='$vuetify.dark ? `teal--text text--lighten-3` : ``') New Folder
|
span.hidden-sm-and-down(:class='$vuetify.dark ? `teal--text text--lighten-3` : ``') New Folder
|
||||||
v-card.wiki-form
|
v-card.wiki-form
|
||||||
|
@ -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
|
// Check if user can upload at path
|
||||||
const assetPath = (folderId) ? hierarchy.map(h => h.slug).join('/') + `/${fileMeta.originalname}` : fileMeta.originalname
|
const assetPath = (folderId) ? hierarchy.map(h => h.slug).join('/') + `/${fileMeta.originalname}` : fileMeta.originalname
|
||||||
if (!WIKI.auth.checkAccess(req.user, ['write:assets'], { path: assetPath })) {
|
if (!WIKI.auth.checkAccess(req.user, ['write:assets'], { path: assetPath })) {
|
||||||
@ -85,7 +88,6 @@ router.post('/u', multer({
|
|||||||
// Process upload file
|
// Process upload file
|
||||||
await WIKI.models.assets.upload({
|
await WIKI.models.assets.upload({
|
||||||
...fileMeta,
|
...fileMeta,
|
||||||
originalname: sanitize(fileMeta.originalname).toLowerCase(),
|
|
||||||
folderId: folderId,
|
folderId: folderId,
|
||||||
assetPath,
|
assetPath,
|
||||||
userId: req.user.id
|
userId: req.user.id
|
||||||
|
@ -42,7 +42,7 @@ module.exports = {
|
|||||||
try {
|
try {
|
||||||
const folderSlug = sanitize(args.slug).toLowerCase()
|
const folderSlug = sanitize(args.slug).toLowerCase()
|
||||||
const parentFolderId = args.parentFolderId === 0 ? null : args.parentFolderId
|
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,
|
parentId: parentFolderId,
|
||||||
slug: folderSlug
|
slug: folderSlug
|
||||||
}).first()
|
}).first()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user