replicatedhq / dockerfilelint

An opinionated Dockerfile linter.
https://www.fromlatest.io
MIT License
979 stars 84 forks source link

Fix JSON parsing in is_valid_shell() when input is no JSON #168

Open egoexpress opened 3 years ago

egoexpress commented 3 years ago

is_valid_shell() breaks when you provide an input that is not proper JSON.

SyntaxError: Unexpected number in JSON at position 1
    at JSON.parse (<anonymous>)

This PR adds a try/catch to prevent that. It also adds the unit tests for is_valid_shell() that were missing.