(fix) avoid escaping values that are quoted (fixes #3296)

pull/215/head
Ludovic Marcotte 2016-03-15 10:38:38 -04:00
parent bfb7fa2e14
commit 17afe7c077
2 changed files with 3 additions and 3 deletions

View File

@ -53,10 +53,10 @@
[aString appendString: @","];
subValue = [self objectAtIndex: count];
/* We MUST quote attribute values that have a ":" in them
/* We MUST quote attribute values that have a ":" or "," in them
and that not already quoted */
if (asAttributes && [subValue length] > 2
&& [subValue rangeOfString: @":"].length
&& ([subValue rangeOfString: @":"].length || [subValue rangeOfString: @","].length)
&& [subValue characterAtIndex: 0] != '"'
&& ![subValue hasSuffix: @"\""])
subValue = [NSString stringWithFormat: @"\"%@\"", subValue];

View File

@ -206,7 +206,7 @@
testEquals([element value: 0 ofAttribute: @"param1"], @"paramvalue1");
testEquals([element value: 1 ofAttribute: @"param1"], @"paramvalue2");
versit = @"BEGIN:GROUP1\r\nELEMENT;PARAM1=paramvalue1\\, with comma:value\r\nEND:GROUP1";
versit = @"BEGIN:GROUP1\r\nELEMENT;PARAM1=\"paramvalue1, with comma\":value\r\nEND:GROUP1";
group = [CardGroup parseSingleFromSource: versit];
testEquals([group versitString], versit);
element = [group firstChildWithTag: @"element"];