From 41aa325e129b4bd5a9fd90a3fcab7120a5bba1ca Mon Sep 17 00:00:00 2001 From: Hivert Quentin Date: Wed, 17 Jun 2026 10:36:15 +0200 Subject: [PATCH] fix(mail): direclty escape curly bracket --- SoObjects/SOGo/NSString+Utilities.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/SoObjects/SOGo/NSString+Utilities.m b/SoObjects/SOGo/NSString+Utilities.m index 634f7c0b7..70bc274f6 100644 --- a/SoObjects/SOGo/NSString+Utilities.m +++ b/SoObjects/SOGo/NSString+Utilities.m @@ -1058,6 +1058,18 @@ static int cssEscapingCount; // Remove @import css (in style tags) regex = [NSRegularExpression regularExpressionWithPattern:@"(<[\\s\\u200B \\\\0]*s[\\s\\u200B \\\\0]*t[\\s\\u200B \\\\0]*y[\\s\\u200B \\\\0]*l[\\s\\u200B \\\\0]*e.*)([\\s\\u200B \\\\0]*@[\\s\\u200B \\\\0]*i[\\s\\u200B \\\\0]*m[\\s\\u200B \\\\0]*p[\\s\\u200B \\\\0]*o[\\s\\u200B \\\\0]*r[\\s\\u200B \\\\0]*t)(.*<[\\s\\u200B \\\\0]*\\/[\\s\\u200B \\\\0]*s[\\s\\u200B \\\\0]*t[\\s\\u200B \\\\0]*y[\\s\\u200B \\\\0]*l[\\s\\u200B \\\\0]*e[\\s\\u200B \\\\0]*>)" options: NSRegularExpressionCaseInsensitive error:&error]; + + + // Remove {{ and }} as they are interprated by angularJS with no way of escaping + regex = [NSRegularExpression regularExpressionWithPattern:@"\\{\\{" + options: NSRegularExpressionCaseInsensitive error:&error]; + newResult = [regex stringByReplacingMatchesInString:result options:0 range:NSMakeRange(0, [result length]) withTemplate:@"{\\\\{"]; + result = [NSString stringWithString: newResult]; + regex = [NSRegularExpression regularExpressionWithPattern:@"\\}\\}" + options: NSRegularExpressionCaseInsensitive error:&error]; + newResult = [regex stringByReplacingMatchesInString:result options:0 range:NSMakeRange(0, [result length]) withTemplate:@"}/}"]; + result = [NSString stringWithString: newResult]; + newResult = result; while([regex numberOfMatchesInString:newResult options:0 range:NSMakeRange(0, [newResult length])] > 0) { newResult = [regex stringByReplacingMatchesInString:newResult options:0 range:NSMakeRange(0, [newResult length]) withTemplate:@"$1@im****$3"];