From b7f0ee7228192e04990a99ec59bc4078a7fa500e Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Mon, 13 Jul 2020 16:40:11 -0400 Subject: [PATCH] fix(mail): use double-quotes for attributes when re-encoding HTML --- SoObjects/Mailer/NSString+Mail.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/SoObjects/Mailer/NSString+Mail.m b/SoObjects/Mailer/NSString+Mail.m index ba88726dc..da9c0e200 100644 --- a/SoObjects/Mailer/NSString+Mail.m +++ b/SoObjects/Mailer/NSString+Mail.m @@ -388,6 +388,7 @@ } if (appendElement && voidTags) { + NSMutableString *value; NSString *type; int i; @@ -396,10 +397,13 @@ for (i = 0; i < [attributes count]; i++) { [result appendString: @" "]; + value = [NSMutableString stringWithString: [attributes valueAtIndex: i]]; + [value replaceString: @"\\" withString: @"\\\\"]; + [value replaceString: @"\"" withString: @"\\\""]; [result appendString: [attributes nameAtIndex: i]]; - [result appendString: @"='"]; - [result appendString: [attributes valueAtIndex: i]]; - [result appendString: @"'"]; + [result appendString: @"=\""]; + [result appendString: value]; + [result appendString: @"\""]; type = [attributes typeAtIndex: i]; if (![type isEqualToString: @"CDATA"])