APIv4 - Respect max length for name with export action
authorColeman Watts <coleman@civicrm.org>
Tue, 17 May 2022 02:30:33 +0000 (22:30 -0400)
committerColeman Watts <coleman@civicrm.org>
Tue, 17 May 2022 02:30:33 +0000 (22:30 -0400)
Civi/Api4/Generic/ExportAction.php

index bb7e14a0c74394e58a28a56cb6279e625aeefc8d..3fc028dacb956efbad6eaff05face340cac50413 100644 (file)
@@ -129,6 +129,8 @@ class ExportAction extends AbstractAction {
       }
     }
     $name = ($parentName ?? '') . $entityType . '_' . ($record['name'] ?? count($this->exportedEntities[$entityType]));
+    // Ensure safe characters, max length
+    $name = \CRM_Utils_String::munge($name, '_', 127);
     $result[] = [
       'name' => $name,
       'entity' => $entityType,