diff --git a/ChangeLog b/ChangeLog index e37e82dbb..c89c74569 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-04-05 Wolfgang Sourdeau + + * SoObjects/SOGo/NSString+Utilities.m (-objectFromJSONString): + added a work-around for JSON strings that were escaped one too + many time, in previous versions of sope-gdl1-xxx. + 2012-04-04 Jean Raby * Added a new tool: 'sogo-tool expire-sessions' diff --git a/SoObjects/SOGo/NSString+Utilities.m b/SoObjects/SOGo/NSString+Utilities.m index 0d01f9970..55838a2dc 100644 --- a/SoObjects/SOGo/NSString+Utilities.m +++ b/SoObjects/SOGo/NSString+Utilities.m @@ -501,6 +501,7 @@ static int cssEscapingCount; SBJsonParser *parser; NSObject *object; NSError *error; + NSString *unescaped; object = nil; @@ -513,9 +514,19 @@ static int cssEscapingCount; error: &error]; if (error) { - [self errorWithFormat: @"json parser: %@", error]; - [self errorWithFormat: @"original string is: %@", self]; - object = nil; + [self errorWithFormat: @"json parser: %@," + @" attempting once more after unescaping...", error]; + unescaped = [self stringByReplacingString: @"\\\\" + withString: @"\\"]; + object = [parser objectWithString: unescaped + error: &error]; + if (error) + { + [self errorWithFormat: @"total failure. Original string is: %@", self]; + object = nil; + } + else + [self logWithFormat: @"initial object deserialized successfully!"]; } }