From 0abda421797c7132f9340a5437027e4c5e665054 Mon Sep 17 00:00:00 2001 From: Michal Kleiner Date: Wed, 10 Feb 2021 11:52:15 +1300 Subject: [PATCH] Use correct directory separator on Windows when selecting email templates --- code/Model/Recipient/EmailRecipient.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/Model/Recipient/EmailRecipient.php b/code/Model/Recipient/EmailRecipient.php index 0fa482d..f060a79 100644 --- a/code/Model/Recipient/EmailRecipient.php +++ b/code/Model/Recipient/EmailRecipient.php @@ -521,8 +521,8 @@ class EmailRecipient extends DataObject } $templatePath = substr($absoluteFilename, strlen($prefixToStrip) + 1); - // Optionally remove "templates/" prefixes - if (preg_match('/(?<=templates\/).*$/', $templatePath, $matches)) { + // Optionally remove "templates/" ("templates\" on Windows respectively) prefixes + if (preg_match('#(?<=templates' . DIRECTORY_SEPARATOR . ').*$#', $templatePath, $matches)) { $templatePath = $matches[0]; }