From 48dde1255f3e4c48fad7617c3999ec3705020fe1 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 8 Jan 2020 08:23:03 -0500 Subject: [PATCH] Loosen restrictions on file names - allow underscores --- ext/afform/core/Civi/Api4/Utils/AfformSaveTrait.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/afform/core/Civi/Api4/Utils/AfformSaveTrait.php b/ext/afform/core/Civi/Api4/Utils/AfformSaveTrait.php index 837af3b569..d35689ce8a 100644 --- a/ext/afform/core/Civi/Api4/Utils/AfformSaveTrait.php +++ b/ext/afform/core/Civi/Api4/Utils/AfformSaveTrait.php @@ -28,8 +28,8 @@ trait AfformSaveTrait { $item['name'] .= $suffix; $orig = NULL; } - elseif (!preg_match('/^[a-zA-Z][a-zA-Z0-9\-]*$/', $item['name'])) { - throw new \API_Exception("Afform.{$this->getActionName()}: name should use alphanumerics and dashes."); + elseif (!preg_match('/^[a-zA-Z][-_a-zA-Z0-9]*$/', $item['name'])) { + throw new \API_Exception("Afform.{$this->getActionName()}: name should begin with a letter and only contain alphanumerics underscores and dashes."); } else { // Fetch existing metadata -- 2.25.1