refactor: is path exist function
This commit is contained in:
parent
ca5be0042d
commit
1559226837
8 changed files with 96 additions and 44 deletions
|
|
@ -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,
|
||||
"ตำแหน่งที่ระบุไม่พบ กรุณาเตรียมตำแหน่งที่ต้องการก่อนดำเนินการ",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue