File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -382,7 +382,7 @@ def as_strings(self):
382382 """Return key as nginx config string."""
383383 if self .value == '' or self .value is None :
384384 return '{0};\n ' .format (self .name )
385- if ';' in self .value or '#' in self .value :
385+ if '"' not in self . value and ( ' ;' in self .value or '#' in self .value and '"' not in self . value ) :
386386 return '{0} "{1}";\n ' .format (self .name , self .value )
387387 return '{0} {1};\n ' .format (self .name , self .value )
388388
@@ -477,11 +477,13 @@ def loads(data, conf=True):
477477 index += m .end ()
478478 continue
479479
480- string_combos = r'[^;]+|"([^"]+)"|\'([^\']+)\''
481- key = r'^\s*({})\s+({})\s*([^;]*?);' .format (string_combos , string_combos )
480+ s1 = r'("[^"]+"|\'[^\']+\'|[^\s;]+)'
481+ s2 = r'("[^"]*"|\'[^\']*\'|[^\s;]*)'
482+ s3 = r'(\s*[^;]*?)'
483+ key = r'^\s*{}\s*{}{};' .format (s1 , s2 , s3 )
482484 m = re .compile (key , re .S ).search (data [index :])
483485 if m :
484- k = Key (m .group (1 ), m .group (4 ) + m .group (7 ))
486+ k = Key (m .group (1 ), m .group (2 ) + m .group (3 ))
485487 if lopen and isinstance (lopen [0 ], (Container , Server )):
486488 lopen [0 ].add (k )
487489 else :
You can’t perform that action at this time.
0 commit comments