diff options
Diffstat (limited to 'pages')
| -rw-r--r-- | pages/api/po/webhook.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/pages/api/po/webhook.ts b/pages/api/po/webhook.ts index 50b3c1f4..e61246a2 100644 --- a/pages/api/po/webhook.ts +++ b/pages/api/po/webhook.ts @@ -53,8 +53,6 @@ export default async function handler( //recipientId === "2" 두번쨰 서명자 서명 완료 const { envelopeId, recipientId } = data; - console.log(req.body) - const contractList = [ { dbName: "contract_envelopes", @@ -133,7 +131,7 @@ export default async function handler( // continue; // } - // const fullFilePath = createFolderTree(fileName, filePath); + // const fullFilePath = createFolderTree(filePath); // fs.writeFileSync(fullFilePath, buffer); } @@ -229,7 +227,7 @@ export default async function handler( continue; } - const fullFilePath = createFolderTree(fileName, filePath); + const fullFilePath = createFolderTree(filePath); fs.writeFileSync(fullFilePath, buffer); @@ -296,7 +294,7 @@ export default async function handler( continue; } - const fullFilePath = createFolderTree(fileName, filePath); + const fullFilePath = createFolderTree(filePath); fs.writeFileSync(fullFilePath, buffer); @@ -324,8 +322,10 @@ export default async function handler( } } -const createFolderTree = (fileName: string, filePath: string): string => { - const cleanedPath = filePath.replace(/^\/+/, ""); +const createFolderTree = (filePath: string): string => { + const fileName = path.basename(filePath); + const folderPath = path.dirname(filePath); + const cleanedPath = folderPath.replace(/^\/+/, ""); const dirPath = path.resolve(process.cwd(), "public", cleanedPath); // 예: 'contracts/185/signatures' const fullFilePath = path.join(dirPath, fileName); // 예: 'contracts/185/signatures/xxx.pdf' |
