Reorganize app workspaces and align Admin architecture
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import vine from '@vinejs/vine'
|
||||
import type { HttpContext } from '@adonisjs/core/http'
|
||||
import { pathSchema } from '#base_modules/FileManager/validator/schemas'
|
||||
import { ROOT_PATH } from '#base_modules/FileManager/config/general'
|
||||
import PathService from '#base_modules/FileManager/services/path_service'
|
||||
|
||||
const pathService = new PathService()
|
||||
|
||||
export default async function getValidatedPathFromRequest(
|
||||
request: HttpContext['request']
|
||||
): Promise<string> {
|
||||
const segments = request.param('*', [ROOT_PATH])
|
||||
const path = pathService.join(...segments.map(decodeURIComponent))
|
||||
return vine.compile(pathSchema).validate(path)
|
||||
}
|
||||
Reference in New Issue
Block a user