Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when having quoted JSON in config #16

Open
kescherCode opened this issue Feb 21, 2021 · 0 comments
Open

Crash when having quoted JSON in config #16

kescherCode opened this issue Feb 21, 2021 · 0 comments

Comments

@kescherCode
Copy link

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.

@kescherCode kescherCode changed the title Crash when returning JSON in location Crash when having quoted JSON in config Feb 21, 2021
@ghostnumber7 ghostnumber7 mentioned this issue May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant