blob: 567cd405e13ef34b7bf20137be9a591d587299ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
import { randomId } from '@/lib/api'
import { POST as route } from 'next-s3-upload/route'
export const POST = route.configure({
key(req, filename) {
const [, extension] = filename.match(/(\.[^\.]*)$/) ?? [null, '']
const timestamp = new Date().toISOString()
const random = randomId()
return `document-${timestamp}-${random}${extension.toLowerCase()}`
},
})
|