From 23007f7115b7699b91110da41581b8023ed6a232 Mon Sep 17 00:00:00 2001 From: Derek Sonnenberg Date: Wed, 16 Oct 2024 16:16:30 -0500 Subject: [PATCH] fix: still use relative path for manifest when folderPath inputs with `./` PE-6975 --- src/node/upload.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/node/upload.ts b/src/node/upload.ts index b351893b..1efaf914 100644 --- a/src/node/upload.ts +++ b/src/node/upload.ts @@ -86,10 +86,15 @@ export class TurboAuthenticatedUploadService extends TurboAuthenticatedBaseUploa } getRelativePath(file: string, params: TurboUploadFolderParams): string { - return file.replace( - (params as NodeUploadFolderParams).folderPath + '/', - '', - ); + let folderPath = (params as NodeUploadFolderParams).folderPath; + + // slice leading `./` if exists + if (folderPath.startsWith('./')) { + folderPath = folderPath.slice(2); + } + + const relativePath = file.replace(folderPath + '/', ''); + return relativePath; } contentTypeFromFile(file: string): string {