View Issue Details

IDProjectCategoryView StatusLast Update
0001760SOGoBackend Address Bookpublic2017-01-09 20:49
Reporteravoegele Assigned Toludovic  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Versionnightly v2 
Fixed in Version3.2.5 
Summary0001760: LDIF entries with ": " in an attribute value aren't imported into the address book
Description

In UI/Contacts/UIxContactFolderActions.m, LDIF attributes are currently split with componentsSeparatedByString. If there's more than one separator in the string, e.g. "description: foo: bar", the LDIF entry isn't imported properly. A patch that uses rangeOfString instead of componentsSeparatedByString is attached.

Additional Information

BTW, shouldn't the else-block that breaks the for-loop be removed? Currently, the LDIF entry's remaining lines aren't processed because of the "break". If the "break" was removed unparseable lines would simply be skipped.

TagsNo tags attached.

Relationships

has duplicate 0003258 resolvedludovic Missing Base64 Encoding for One Liners in Description (LDIF Export/Import) 

Activities

2012-04-09 15:34

 

UI_Contacts_UIxContactFolderActions_m.diff (1,607 bytes)   
#
# old_revision [ba40327d7cdcc284485580a61af95f9056989d40]
#
# patch "UI/Contacts/UIxContactFolderActions.m"
#  from [2a053b17e4cf4dbf46e9ba6cb282d68a2072a5aa]
#    to [4b7bceea09557a1b86608adc7a839d6a5372c87c]
#
============================================================
--- UI/Contacts/UIxContactFolderActions.m	2a053b17e4cf4dbf46e9ba6cb282d68a2072a5aa
+++ UI/Contacts/UIxContactFolderActions.m	4b7bceea09557a1b86608adc7a839d6a5372c87c
@@ -143,7 +143,7 @@
 {
   SOGoContactGCSFolder *folder;
   NSString *key, *value;
-  NSArray *ldifContacts, *lines, *components;
+  NSArray *ldifContacts, *lines;
   NSMutableDictionary *entry;
   NGVCard *vCard;
   NSString *uid;
@@ -167,6 +167,7 @@
       linesCount = [lines count];
       for (j = 0; j < linesCount; j++)
         {
+          NSRange keyValueSeparatorRange;
           NSString *line;
           line = [lines objectAtIndex: j];
 
@@ -189,11 +190,12 @@
               continue;
             }
 
-          components = [line componentsSeparatedByString: @": "];
-          if ([components count] == 2)
+          keyValueSeparatorRange = [line rangeOfString: @": "];
+          if (keyValueSeparatorRange.location != NSNotFound)
             {
-              key = [[components objectAtIndex: 0] lowercaseString];
-              value = [components objectAtIndex: 1];
+              key = [[line substringToIndex: keyValueSeparatorRange.location]
+                      lowercaseString];
+              value = [line substringFromIndex: NSMaxRange(keyValueSeparatorRange)];
 
               if ([key length] == 0)
                 key = @"dn";
Christian Mack

Christian Mack

2013-11-28 10:27

developer   ~0006301

Any news on this?

Related Changesets

sogo: master 4f211678

2016-12-29 16:21

ludovic


Details Diff
(fix) handle semicolon in value during LDIF import (fixes 0001760) Affected Issues
0001760
mod - UI/Contacts/UIxContactFolderActions.m Diff File

sogo: v2 e46c51e2

2016-12-29 16:21

ludovic


Details Diff
(fix) handle semicolon in value during LDIF import (fixes 0001760) Affected Issues
0001760
mod - UI/Contacts/UIxContactFolderActions.m Diff File

sogo: maint 56b92307

2016-12-29 16:21

ludovic

Committer: francis


Details Diff
(fix) handle semicolon in value during LDIF import (fixes 0001760) Affected Issues
0001760
mod - UI/Contacts/UIxContactFolderActions.m Diff File

Issue History

Date Modified Username Field Change
2012-04-09 15:34 avoegele New Issue
2012-04-09 15:34 avoegele File Added: UI_Contacts_UIxContactFolderActions_m.diff
2013-11-28 10:27 Christian Mack Note Added: 0006301
2016-12-29 21:22 ludovic Changeset attached => sogo master 4f211678
2016-12-29 21:22 ludovic Assigned To => ludovic
2016-12-29 21:22 ludovic Resolution open => fixed
2016-12-29 21:22 ludovic Changeset attached => sogo v2 e46c51e2
2016-12-29 21:23 ludovic Status new => resolved
2016-12-29 21:23 ludovic Fixed in Version => 3.2.5
2016-12-30 21:00 ludovic Relationship added has duplicate 0003258
2017-01-09 20:49 francis Changeset attached => sogo maint 56b92307