From 2a3f153e46cb60943e608a73013a05f912089188 Mon Sep 17 00:00:00 2001 From: manfred Date: Thu, 16 Feb 2023 15:19:27 +0100 Subject: [PATCH 1/2] In AssetReferenceUpdater, method updateBardFieldValues, check the actual datatype of the field content to prevent errors --- src/Assets/AssetReferenceUpdater.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Assets/AssetReferenceUpdater.php b/src/Assets/AssetReferenceUpdater.php index ecf0f16e8e..710b4220e2 100644 --- a/src/Assets/AssetReferenceUpdater.php +++ b/src/Assets/AssetReferenceUpdater.php @@ -101,7 +101,12 @@ protected function updateBardFieldValues($fields, $dottedPrefix) && $field->get('container') === $this->container; }) ->each(function ($field) use ($dottedPrefix) { - $field->get('save_html') === true + $data = $this->item->data()->all(); + $dottedKey = $dottedPrefix.$field->handle(); + $bardPayload = Arr::get($data, $dottedKey, []); + $isString = is_string($bardPayload); + + ($field->get('save_html') === true || $isString) ? $this->updateStatamicUrlsInStringValue($field, $dottedPrefix) : $this->updateStatamicUrlsInArrayValue($field, $dottedPrefix); }); From e80122098d31879a4bbb9eb8efb95b5122f4ee2e Mon Sep 17 00:00:00 2001 From: manfred Date: Thu, 16 Feb 2023 15:28:13 +0100 Subject: [PATCH 2/2] fixed styleCI codestyle issue --- src/Assets/AssetReferenceUpdater.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Assets/AssetReferenceUpdater.php b/src/Assets/AssetReferenceUpdater.php index 710b4220e2..c4811f6246 100644 --- a/src/Assets/AssetReferenceUpdater.php +++ b/src/Assets/AssetReferenceUpdater.php @@ -104,7 +104,7 @@ protected function updateBardFieldValues($fields, $dottedPrefix) $data = $this->item->data()->all(); $dottedKey = $dottedPrefix.$field->handle(); $bardPayload = Arr::get($data, $dottedKey, []); - $isString = is_string($bardPayload); + $isString = is_string($bardPayload); ($field->get('save_html') === true || $isString) ? $this->updateStatamicUrlsInStringValue($field, $dottedPrefix)