mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-11 03:24:16 +00:00
use random id to generate id
This commit is contained in:
parent
685af011c1
commit
494fbc707d
@ -1,5 +1,6 @@
|
|||||||
import path from "path"
|
import path from "path"
|
||||||
import fs from "fs"
|
import fs from "fs"
|
||||||
|
import { nanoid } from 'nanoid'
|
||||||
|
|
||||||
import pmap from "../../../utils/pMap"
|
import pmap from "../../../utils/pMap"
|
||||||
|
|
||||||
@ -41,9 +42,7 @@ export default async (payload) => {
|
|||||||
maxFileSize: params.maxFileSize,
|
maxFileSize: params.maxFileSize,
|
||||||
maxFields: params.maxFields,
|
maxFields: params.maxFields,
|
||||||
filename: (name, ext) => {
|
filename: (name, ext) => {
|
||||||
name = name.trim()
|
name = nanoid()
|
||||||
name = name.replace(/ /g, "_")
|
|
||||||
name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, "")
|
|
||||||
|
|
||||||
return name + ext
|
return name + ext
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user