From 49a35a4eee8fb4efa1bb0c111167bfd4e1bb78d6 Mon Sep 17 00:00:00 2001 From: Iwona Just Date: Wed, 4 Sep 2024 15:10:52 +0100 Subject: [PATCH] if we don't have extension, don't add a full stop to the filename --- src/fields/Assets.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/fields/Assets.php b/src/fields/Assets.php index 09978fed..e8126bcf 100644 --- a/src/fields/Assets.php +++ b/src/fields/Assets.php @@ -181,7 +181,14 @@ public function parseField(): mixed $urlsToUpload[$key]['value'] = $dataValue; if (isset($filenamesFromFeed[$key])) { - $filename = $filenamesFromFeed[$key] . '.' . AssetHelper::getRemoteUrlExtension($urlsToUpload[$key]['value']); + $filename = $filenamesFromFeed[$key]; + + // if we can determine the extension of the remote file, use that extension + $remoteUrlExtension = AssetHelper::getRemoteUrlExtension($urlsToUpload[$key]['value']); + if (!empty($remoteUrlExtension)) { + $filename .= '.' . $remoteUrlExtension; + } + $urlsToUpload[$key]['newFilename'] = $filename; } else { $filename = AssetHelper::getRemoteUrlFilename($dataValue);