File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -1492,12 +1492,16 @@ def _filter_empty_field(data_d):
14921492 Remove empty lists from dictionary values
14931493 Before: {'target': {'CHECKSUM': {'checksum-fill': []}}}
14941494 After: {'target': {'CHECKSUM': {'checksum-fill': ''}}}
1495+ Before: {'tcp': {'dport': ['22']}}}
1496+ After: {'tcp': {'dport': '22'}}}
14951497 """
14961498 for k , v in data_d .items ():
14971499 if isinstance (v , dict ):
14981500 data_d [k ] = _filter_empty_field (v )
14991501 elif isinstance (v , list ) and len (v ) != 0 :
15001502 v = [_filter_empty_field (_v ) if isinstance (_v , dict ) else _v for _v in v ]
1503+ if isinstance (v , list ) and len (v ) == 1 :
1504+ data_d [k ] = v .pop ()
15011505 elif isinstance (v , list ) and len (v ) == 0 :
15021506 data_d [k ] = ''
15031507 return data_d
You can’t perform that action at this time.
0 commit comments