From 4b5077389a9731d4ea7cfa4739d42e54fddf2406 Mon Sep 17 00:00:00 2001 From: raj pandey Date: Fri, 7 Jun 2024 17:48:09 +0530 Subject: [PATCH] fixed sre issue --- package-lock.json | 20 ++++++++++---------- package.json | 2 +- src/core/content-type/diagram.ts | 4 +++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index c0600e0..d244bfb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "@contentstack/cli-command": "^1.2.17", - "@contentstack/cli-utilities": "^1.6.1", + "@contentstack/cli-utilities": "^1.6.2", "@types/diff2html": "^3.0.0", "@types/git-diff": "^2.0.2", "@types/hogan.js": "^3.0.0", @@ -1614,9 +1614,9 @@ } }, "node_modules/@oclif/plugin-help/node_modules/@oclif/core": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@oclif/core/-/core-4.0.2.tgz", - "integrity": "sha512-0r+JwE1FbVlEYNQlLonMULnZb6rKR0RqT8eUgKeJTb5cILhsKUjlZf2NLIX4GP3SZrK8POwGGLcztmj42hZYiw==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@oclif/core/-/core-4.0.3.tgz", + "integrity": "sha512-yM8R/M2WfSNfL9eF8clS/SbQvanvHZJgoij5bLs3ro7uAFCkL/LYcagyj0UVGbysx5AI+SNIof6OHQUXYZpOZw==", "dev": true, "dependencies": { "ansi-escapes": "^4.3.2", @@ -3475,9 +3475,9 @@ } }, "node_modules/aws-sdk": { - "version": "2.1635.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1635.0.tgz", - "integrity": "sha512-zab4y8ftjgcctYao33c1fr8Yx1wMuRlEbZT7hwEXcK8Ta3+LAEXJs1wKjPpium+KUwl6zw7wxhaIdEibiz6InA==", + "version": "2.1636.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1636.0.tgz", + "integrity": "sha512-0w/jOCYnwewLYjH4UCh3GTBjR/NMdvEKNrd1pnM4FvfJSmjfzCinDvmf5Qc6xeIrqPfrdYOoQh7NJhYeJScCIQ==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -5401,9 +5401,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.791", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.791.tgz", - "integrity": "sha512-6FlqP0NSWvxFf1v+gHu+LCn5wjr1pmkj5nPr7BsxPnj41EDR4EWhK/KmQN0ytHUqgTR1lkpHRYxvHBLZFQtkKw==", + "version": "1.4.794", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.794.tgz", + "integrity": "sha512-6FApLtsYhDCY0Vglq3AptsdxQ+PJLc6AxlAM0HjEihUAiOPPbkASEsq9gtxUeZY9o0sJIEa3WnF0vVH4VT4iug==", "dev": true }, "node_modules/emittery": { diff --git a/package.json b/package.json index 10759ef..98714fb 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "bugs": "https://github.com/Contentstack-Solutions/contentstack-cli-content-type/issues", "dependencies": { "@contentstack/cli-command": "^1.2.17", - "@contentstack/cli-utilities": "^1.6.1", + "@contentstack/cli-utilities": "^1.6.2", "@types/diff2html": "^3.0.0", "@types/git-diff": "^2.0.2", "@types/hogan.js": "^3.0.0", diff --git a/src/core/content-type/diagram.ts b/src/core/content-type/diagram.ts index 774fae6..6fc3c6d 100644 --- a/src/core/content-type/diagram.ts +++ b/src/core/content-type/diagram.ts @@ -12,6 +12,8 @@ DiagramNodeType, Format } from '../../types' +import { sanitizePath } from '@contentstack/cli-utilities'; + const theme = { graph: { fontname: 'Helvetica', @@ -290,7 +292,7 @@ function flattenFields(fields: DiagramNodeField[], depth = 0, prefix = '') { } function createOutputPath(outputFile: string) { - const outputPath = path.resolve(process.cwd(), outputFile) + const outputPath = path.resolve(sanitizePath(process.cwd()), sanitizePath(outputFile)) const dirName = path.dirname(outputPath) fs.mkdirSync(dirName, {recursive: true})