Skip to content

Commit b96b750

Browse files
authored
Revert path.join to path.resolve (#285)
1 parent 0625be1 commit b96b750

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,11 @@ export class SocketSdk {
468468
filepaths: string[],
469469
pathsRelativeTo: string = '.'
470470
): Promise<SocketSdkResultType<'CreateOrgFullScan'>> {
471-
const basePath = path.join(process.cwd(), pathsRelativeTo)
471+
// Resolve will process path segments until it creates a valid absolute
472+
// path. So if the given pathsRelativeTo is an absolute path, the cwd()
473+
// is not used, which is the common expectation. If none of the paths
474+
// resolve then it defaults to process.cwd()
475+
const basePath = path.resolve(process.cwd(), pathsRelativeTo)
472476
const absFilepaths = filepaths.map(p => path.join(basePath, p))
473477
try {
474478
const data = await getResponseJson(

0 commit comments

Comments
 (0)