Skip to content

Commit

Permalink
(fix) avoid escaping values that are quoted (fixes #3296)
Browse files Browse the repository at this point in the history
  • Loading branch information
extrafu committed Mar 15, 2016
1 parent bfb7fa2 commit 17afe7c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions SOPE/NGCards/NSDictionary+NGCards.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ - (BOOL) _renderAsSubValuesInString: (NSMutableString *) aString
[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];
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/TestVersit.m
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ - (void) test_parsing
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"];
Expand Down

0 comments on commit 17afe7c

Please sign in to comment.