Skip to content

Commit

Permalink
if we don't have extension, don't add a full stop to the filename
Browse files Browse the repository at this point in the history
  • Loading branch information
i-just committed Sep 4, 2024
1 parent e28b876 commit 49a35a4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/fields/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 49a35a4

Please sign in to comment.