Skip to content

Commit

Permalink
Fix: edge case for transplanting multiline json string (#102)
Browse files Browse the repository at this point in the history
* Fix: edge case for transplanting multiline json string

When trying to copy a multiline json string from a yaml to a string in another yaml, there are issues with the JSON being parsed during the initial get which is undesireable. if this edge case applies to you, you can use this new type jsonString to let us know it is a json string that you want to stay a json string at its destination. we will force the quotes back to the proper escape level.

* Build: npm audit-ci breaking the build, going back to npm audit
  • Loading branch information
alewitt2 authored May 5, 2020
1 parent 3d66ecf commit ecbf216
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 194 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ node_js:
- "11"

script:
- if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then npx audit-ci --low; else npx audit-ci --low || true; fi
- if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then npm audit; else npm audit || true; fi
- npm run lint
- npm test
- if [ -n "${TRAVIS_TAG}" ]; then npm version --no-git-tag-version "${TRAVIS_TAG}"; fi
Expand Down
5 changes: 5 additions & 0 deletions lib/FetchEnvs.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ module.exports = class FetchEnvs {
case 'json':
result = JSON.parse(result);
break;
case 'jsonString':
// result = JSON.stringify(result);
// result = result.slice(1, result.length - 1);
result = result.replace(/\n/g, '').replace(/"/g, '\\"').replace(/\s+/g, '');
break;
case 'base64':
result = new Buffer(result).toString('base64');
break;
Expand Down
192 changes: 0 additions & 192 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
},
"devDependencies": {
"@razee/kubernetes-util": "^0.1.0",
"audit-ci": "^2.2.0",
"chai": "^4.2.0",
"eslint": "^6.1.0",
"markdownlint-cli": "^0.22.0",
Expand Down

0 comments on commit ecbf216

Please sign in to comment.