From 6b25b634f6592d72bfd5810a14bbe771bf4ecd42 Mon Sep 17 00:00:00 2001 From: James Edmonston Date: Wed, 23 Dec 2020 11:50:31 +0000 Subject: [PATCH] Fix file type regex on GraphQL asset mutations Following on from https://github.com/craftcms/cms/issues/7327, I modified the regex and ran some tests, and it seems to all be working correctly now. --- src/gql/resolvers/mutations/Asset.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gql/resolvers/mutations/Asset.php b/src/gql/resolvers/mutations/Asset.php index 2b9030fc5ae..0dc066cc86d 100644 --- a/src/gql/resolvers/mutations/Asset.php +++ b/src/gql/resolvers/mutations/Asset.php @@ -177,7 +177,7 @@ protected function handleUpload(AssetElement $asset, array $fileInformation): bo $dataString = $fileInformation['fileData']; $fileData = null; - if (preg_match('/^data:((?[a-z0-9]+\/[a-z0-9\+]+);)?base64,(?.+)/i', $dataString, $matches)) { + if (preg_match('/^data:((?[a-z0-9]+\/[a-z0-9\+\.\-]+);)?base64,(?.+)/i', $dataString, $matches)) { // Decode the file $fileData = base64_decode($matches['data']); }