From 890e00194b9a9d3ff250bfde117e94d840bdd120 Mon Sep 17 00:00:00 2001 From: Brad Bell Date: Tue, 9 Jul 2024 15:33:09 -0500 Subject: [PATCH 1/4] 5.6.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e75ffd0..5d9894a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Release Notes for Feed Me -## Unreleased +## 5.6.0 - 2024-07-09 - Fixed a bug where simple value comparisons would fail if the value you were checking against was missing. ([#1473](https://github.com/craftcms/feed-me/pull/1473)) - Fixed a bug where assets imported into a Matrix field with “Use this filename for assets created from URL” set would duplicate the first asset across all Matrix blocks. ([#1472](https://github.com/craftcms/feed-me/pull/1472)) From 46a884c4505fd57e54f5279996175fd73e49a1f4 Mon Sep 17 00:00:00 2001 From: Iwona Just Date: Wed, 17 Jul 2024 11:08:41 +0200 Subject: [PATCH 2/4] filenames can be empty - don't freak out --- src/fields/Assets.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fields/Assets.php b/src/fields/Assets.php index a1bdd27f..09978fed 100644 --- a/src/fields/Assets.php +++ b/src/fields/Assets.php @@ -118,8 +118,10 @@ public function parseField(): mixed $base64ToUpload = []; $filenamesFromFeed = $upload ? DataHelper::fetchArrayValue($this->feedData, $this->fieldInfo, 'options.filenameNode') : null; - // see https://github.com/craftcms/feed-me/issues/1471 - $filenamesFromFeed = array_splice($filenamesFromFeed, $nodeKey, count($value)); + if ($filenamesFromFeed) { + // see https://github.com/craftcms/feed-me/issues/1471 + $filenamesFromFeed = array_splice($filenamesFromFeed, $nodeKey, count($value)); + } // Fire an 'onAssetFilename' event $event = new AssetFilenameEvent([ From d4f40750f6c314b83b7f874fffd97d81be6ecdc0 Mon Sep 17 00:00:00 2001 From: Iwona Just Date: Wed, 17 Jul 2024 11:09:00 +0200 Subject: [PATCH 3/4] remove usedefault from assets field filename dropdown --- src/templates/_includes/fields/assets.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/templates/_includes/fields/assets.html b/src/templates/_includes/fields/assets.html index 1e49b21b..eb94839f 100644 --- a/src/templates/_includes/fields/assets.html +++ b/src/templates/_includes/fields/assets.html @@ -75,7 +75,7 @@ label: 'Use this filename for assets created from URL:'|t('feed-me'), name: 'options[filenameNode]', value: hash_get(feed.fieldMapping, optionsPath ~ '.filenameNode') ?: '', - options: feedData, + options: feedData|filter(option => option.value != 'usedefault'), class: 'selectize fullwidth', }) }} From 09a59952b9ccb55884592eee55b67b9cedbd37d6 Mon Sep 17 00:00:00 2001 From: Brad Bell Date: Thu, 18 Jul 2024 11:41:41 -0700 Subject: [PATCH 4/4] Changelog for https://github.com/craftcms/feed-me/pull/1483 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d9894a2..6d6fae7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release Notes for Feed Me +## Unreleased + +- Fixed a PHP error that could occur when importing Assets that had a missing filename. ([#1481](https://github.com/craftcms/feed-me/pull/1481)) + ## 5.6.0 - 2024-07-09 - Fixed a bug where simple value comparisons would fail if the value you were checking against was missing. ([#1473](https://github.com/craftcms/feed-me/pull/1473))