@@ -618,6 +618,41 @@ func TestConvertTagsStringToMap(t *testing.T) {
618
618
expectedOutput : nil ,
619
619
expectedError : true ,
620
620
},
621
+ {
622
+ name : "tag value contains escaped delimiters" ,
623
+ tags : "parent1/key1/value\\ ,with\\ ,comas,parent2/key2/value3" ,
624
+ expectedOutput : map [string ]string {
625
+ "parent1/key1" : "value,with,comas" ,
626
+ "parent2/key2" : "value3" ,
627
+ },
628
+ expectedError : false ,
629
+ },
630
+ {
631
+ name : "tag value contains unescaped comas" ,
632
+ tags : "parent1/key1/value,with,comas,parent2/key2/value3" ,
633
+ expectedOutput : map [string ]string {
634
+ "parent1/key1" : "value,with,comas" ,
635
+ "parent2/key2" : "value3" ,
636
+ },
637
+ expectedError : true ,
638
+ },
639
+ {
640
+ name : "tag value contains escapes for non delimiter characters" ,
641
+ tags : "p\\ arent1/key1/value1,parent2/key2/value2" ,
642
+ expectedOutput : map [string ]string {
643
+ "parent1/key1" : "value1" ,
644
+ "parent2/key2" : "value2" ,
645
+ },
646
+ expectedError : false ,
647
+ },
648
+ {
649
+ name : "tag value contains a sequence of escape characters" ,
650
+ tags : "parent1/key1/\\ \\ value\\ " ,
651
+ expectedOutput : map [string ]string {
652
+ "parent1/key1" : "value" ,
653
+ },
654
+ expectedError : false ,
655
+ },
621
656
}
622
657
623
658
for _ , tc := range testCases {
@@ -756,6 +791,11 @@ func TestConvertTagsStringToMap(t *testing.T) {
756
791
tags : "parent/k/Special@value[10]{20}(30)-example" ,
757
792
expectedError : false ,
758
793
},
794
+ {
795
+ name : "tag value may contain escaped comas" ,
796
+ tags : "parent/k/v\\ ,v" ,
797
+ expectedError : false ,
798
+ },
759
799
}
760
800
761
801
for _ , tc := range testCases {
0 commit comments