diff --git a/package-lock.json b/package-lock.json index 10e9d1d..8d4a57b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,33 +12,19 @@ "@contentstack/cli-command": "^1.3.2", "@contentstack/cli-utilities": "^1.8.0", "@contentstack/types-generator": "^2.0.3", - "async": "^3.2.6", - "dotenv": "^16.4.7", - "fancy-test": "^3.0.16", - "graphql": "^16.8.1", - "lodash": "^4.17.21", - "prettier": "^3.4.2", - "tslib": "^2.8.1" + "dotenv": "^16.4.7" }, "devDependencies": { "@oclif/plugin-help": "^3.3.1", "@oclif/test": "^4.0.9", - "@types/async": "^3.2.24", - "@types/chai": "^4.3.20", "@types/jest": "^26.0.24", - "@types/lodash": "^4.17.14", - "@types/mocha": "^10.0.10", "@types/node": "^10.17.60", - "chai": "^5.1.2", "eslint": "^5.16.0", "eslint-config-oclif": "^3.1.2", "eslint-config-oclif-typescript": "^0.2.0", - "globby": "^10.0.2", "jest": "^26.6.3", - "mocha": "^10.7.3", "oclif": "^3.17.2", "ts-jest": "^26.5.6", - "ts-node": "^10.9.2", "typescript": "^4.9.5" }, "engines": { @@ -16026,45 +16012,6 @@ "license": "MIT", "optional": true }, - "node_modules/recheck-linux-x64": { - "version": "4.4.5", - "resolved": "https://registry.npmjs.org/recheck-linux-x64/-/recheck-linux-x64-4.4.5.tgz", - "integrity": "sha512-s8OVPCpiSGw+tLCxH3eei7Zp2AoL22kXqLmEtWXi0AnYNwfuTjZmeLn2aQjW8qhs8ZPSkxS7uRIRTeZqR5Fv/Q==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/recheck-macos-x64": { - "version": "4.4.5", - "resolved": "https://registry.npmjs.org/recheck-macos-x64/-/recheck-macos-x64-4.4.5.tgz", - "integrity": "sha512-Ouup9JwwoKCDclt3Na8+/W2pVbt8FRpzjkDuyM32qTR2TOid1NI+P1GA6/VQAKEOjvaxgGjxhcP/WqAjN+EULA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/recheck-windows-x64": { - "version": "4.4.5", - "resolved": "https://registry.npmjs.org/recheck-windows-x64/-/recheck-windows-x64-4.4.5.tgz", - "integrity": "sha512-mkpzLHu9G9Ztjx8HssJh9k/Xm1d1d/4OoT7etHqFk+k1NGzISCRXBD22DqYF9w8+J4QEzTAoDf8icFt0IGhOEQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", diff --git a/package.json b/package.json index 82e3b1e..9118375 100644 --- a/package.json +++ b/package.json @@ -8,33 +8,19 @@ "@contentstack/cli-command": "^1.3.2", "@contentstack/cli-utilities": "^1.8.0", "@contentstack/types-generator": "^2.0.3", - "async": "^3.2.6", - "dotenv": "^16.4.7", - "fancy-test": "^3.0.16", - "graphql": "^16.8.1", - "lodash": "^4.17.21", - "prettier": "^3.4.2", - "tslib": "^2.8.1" + "dotenv": "^16.4.7" }, "devDependencies": { "@oclif/plugin-help": "^3.3.1", "@oclif/test": "^4.0.9", - "@types/async": "^3.2.24", - "@types/chai": "^4.3.20", "@types/jest": "^26.0.24", - "@types/lodash": "^4.17.14", - "@types/mocha": "^10.0.10", "@types/node": "^10.17.60", - "chai": "^5.1.2", "eslint": "^5.16.0", "eslint-config-oclif": "^3.1.2", "eslint-config-oclif-typescript": "^0.2.0", - "globby": "^10.0.2", "jest": "^26.6.3", - "mocha": "^10.7.3", "oclif": "^3.17.2", "ts-jest": "^26.5.6", - "ts-node": "^10.9.2", "typescript": "^4.9.5" }, "engines": { @@ -63,7 +49,7 @@ "repository": "Contentstack-Solutions/contentstack-cli-tsgen", "scripts": { "postpack": "rm -f oclif.manifest.json", - "posttest": "eslint . --ext .ts --config .eslintrc", + "posttest": "eslint . --ext .ts --config .eslintrc --fix", "prepack": "rm -rf lib && tsc -b && oclif manifest && oclif readme", "test": "jest --testPathPattern=tests", "version": "oclif readme && git add README.md", diff --git a/src/lib/helper.ts b/src/lib/helper.ts index 11e56d7..f28cac8 100644 --- a/src/lib/helper.ts +++ b/src/lib/helper.ts @@ -1 +1,5 @@ -export const sanitizePath = (str: string) => str?.replace(/^(\.\.(\/|\\|$))+/, ''); \ No newline at end of file +export const sanitizePath = (str: string) => { + return str + ?.replace(/[\/\\]+/g, "/") // Replace multiple slashes/backslashes with a single '/' + .replace(/(\.\.(\/|\\|$))+/g, ""); // Remove directory traversal (../ or ..\) +} \ No newline at end of file