nginxbeautifier
nginxbeautifier copied to clipboard
Crash when having quoted JSON in config
I have a config with this location block in it:
location = /.well-known/matrix/server {
default_type application/json;
return 200 '{"m.server":"matrix.kescher.at:443"}';
}
If nginxbeautifier tries to format this, it crashes with the following error:
/tmp/nginxbeautifier/nginxbeautifier.js:142
return input.match(catchRegex)[1];
^
TypeError: Cannot read property '1' of null
at extractTextBySeperator (/tmp/nginxbeautifier/nginxbeautifier.js:142:39)
at extractAllPossibleText (/tmp/nginxbeautifier/nginxbeautifier.js:164:29)
at strip_line (/tmp/nginxbeautifier/nginxbeautifier.js:193:35)
at Object.clean_lines (/tmp/nginxbeautifier/nginxbeautifier.js:225:50)
at Object.<anonymous> (/tmp/nginxbeautifier/index.js:235:38)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
It seems that it tries to format curly braces within single-quoted strings, which it shouldn't.