refactor: is path exist function

This commit is contained in:
Methapon2001 2023-11-27 16:07:32 +07:00
parent ca5be0042d
commit 1559226837
No known key found for this signature in database
GPG key ID: 849924FEF46BD132
8 changed files with 96 additions and 44 deletions

View file

@ -88,9 +88,10 @@ export class SubFolderFileController extends Controller {
@Path() folderName: string,
@Path() subFolderName: string,
) {
const pathname = `${cabinetName}/${drawerName}/${folderName}/${subFolderName}/${body.file}`;
const basePath = `${cabinetName}/${drawerName}/${folderName}/${subFolderName}/`;
const pathname = `${basePath}${body.file}`;
if (!(await pathExist(`${cabinetName}/${drawerName}/${folderName}/${subFolderName}`))) {
if (!(await pathExist(DEFAULT_BUCKET!, basePath))) {
throw new HttpError(
HttpStatusCode.NOT_FOUND,
"ตำแหน่งที่ระบุไม่พบ กรุณาเตรียมตำแหน่งที่ต้องการก่อนดำเนินการ",