From 7cc3ff2fccb7905300456b01091286581e4b3842 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Tue, 30 May 2017 13:15:04 -0400 Subject: [PATCH] (fix) remove any trailing cr (fixes #4172) --- UI/Contacts/UIxContactFolderActions.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/UI/Contacts/UIxContactFolderActions.m b/UI/Contacts/UIxContactFolderActions.m index c4b8063c77..b095bf87fb 100644 --- a/UI/Contacts/UIxContactFolderActions.m +++ b/UI/Contacts/UIxContactFolderActions.m @@ -165,7 +165,7 @@ - (int) importLdifData: (NSString *) ldifData id value; NSRange r; - int i, j, count, linesCount; + int i, j, count, linesCount, len; int rc; folder = [self clientObject]; @@ -184,6 +184,11 @@ - (int) importLdifData: (NSString *) ldifData for (j = 0; j < linesCount; j++) { line = [lines objectAtIndex: j]; + len = [line length]; + + /* we check for trailing \r and we strip them */ + if (len && [line characterAtIndex: len-1] == '\r') + line = [line substringToIndex: len-1]; /* skip embedded comment lines */ if ([line hasPrefix: @"#"])