vasilevich / nginxbeautifier

Format and beautify nginx config files
https://nginxbeautifier.com
Apache License 2.0
167 stars 20 forks source link

Unsupported Regex separator #19

Closed sogos closed 2 years ago

sogos commented 3 years ago

Hello,

I was testing your (very cool) software and it seem this content make it crash:

server {
        listen 0.0.0.0:8080;
        server_name _;

        set $bucket "xxx.s3.fr-par.scw.cloud";

        location ~ "^/assets/.+-[0-9a-f]{32}.*" {
                resolver 8.8.8.8 8.8.4.4 ipv6=off;
                gzip_static on;
                add_header Cache-Control public;
                proxy_cache assets_cache;
                proxy_http_version 1.1;
                proxy_redirect off;
                proxy_set_header Connection "";
                proxy_set_header Authorization '';
                proxy_set_header Host $bucket;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_hide_header x-amz-id-2;
                proxy_hide_header x-amz-request-id;
                proxy_hide_header x-amz-meta-server-side-encryption;
                proxy_hide_header x-amz-server-side-encryption;
                proxy_hide_header Set-Cookie;
                proxy_ignore_headers Set-Cookie;
                proxy_cache_revalidate on;
                proxy_intercept_errors on;
                proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
                proxy_cache_lock on;
                proxy_cache_valid 200 304 60m;
                add_header Cache-Control max-age=31536000;
                add_header X-Cache-Status $upstream_cache_status;
                proxy_pass https://$bucket;
        }

}

with error

/home/thibault/.npm-packages/lib/node_modules/nginxbeautifier/nginxbeautifier.js:142
        return input.match(catchRegex)[1];
                                      ^

TypeError: Cannot read property '1' of null
    at extractTextBySeperator (/home/thibault/.npm-packages/lib/node_modules/nginxbeautifier/nginxbeautifier.js:142:39)

Thanks