replicatedhq / dockerfilelint

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

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

Closed egoexpress closed 2 months 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.