File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -241,7 +241,7 @@ module.exports = class Parser {
241
241
innerLines = lineRaw
242
242
. replace ( / ( \s + { ) / g, '\n$1\n' )
243
243
. replace ( / ( ; \s * ) } / g, '$1\n}\n' )
244
- . replace ( / ; / g, ';\n' )
244
+ . replace ( / ; \s * ? $ / g, ';\n' )
245
245
. split ( / \n / )
246
246
247
247
innerLines . forEach ( line => {
Original file line number Diff line number Diff line change @@ -163,6 +163,18 @@ describe('toJSON', () => {
163
163
164
164
parser . toJSON ( configString ) . should . deep . equal ( { 'geo $limited' : { default : '1' , '10.0.0.0/8' : '0' } } )
165
165
} )
166
+
167
+ it ( 'should handle multiple semicolon in single line' , ( ) => {
168
+ // attempt to fix issue [#22](https://github.com/webantic/nginx-config-parser/issues/22)
169
+ const configString = [
170
+ 'server {' ,
171
+ ' add_header Strict-Transport-Security "max-age=0; includeSubDomains" always;' ,
172
+ '}'
173
+ ] . join ( '\n' ) ;
174
+
175
+ parser . toJSON ( configString ) . should . deep . equal ( { server : { add_header :
176
+ `Strict-Transport-Security "max-age=0; includeSubDomains" always` } } ) ;
177
+ } )
166
178
} )
167
179
168
180
describe ( 'toConf' , ( ) => {
You can’t perform that action at this time.
0 commit comments