From 42f4b0f425ec57f8b3b046d31635eb611fb765e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Ca=C3=B1ete?= Date: Wed, 6 Jul 2022 21:58:39 +0200 Subject: [PATCH] change the way to check skipped content MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel CaƱete --- .../src/scaffolder/actions/builtin/fetch/template.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts index 93ed7645c0..5e076cabab 100644 --- a/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts +++ b/plugins/scaffolder-backend/src/scaffolder/actions/builtin/fetch/template.ts @@ -27,6 +27,7 @@ import { TemplateFilter, SecureTemplater, } from '../../../../lib/templating/SecureTemplater'; +import path from 'node:path'; /** * Downloads a skeleton, templates variables into file and directory names and content. @@ -260,12 +261,12 @@ export function createFetchTemplateAction(options: { } function containsSkippedContent(localOutputPath: string): boolean { - // if the path starts with / means that the root directory has been skipped + // if the path is absolute means that the root directory has been skipped // if the path is empty means that there is a file skipped in the root // if the path includes // means that there is a subdirectory skipped return ( - localOutputPath.startsWith('/') || localOutputPath === '' || - localOutputPath.includes('//') + path.isAbsolute(localOutputPath) || + localOutputPath.includes(`${path.sep}${path.sep}`) ); }