From 19107521cfdaa8949eed40bb76f042f540e4afe9 Mon Sep 17 00:00:00 2001 From: vnali <55586085+vnali@users.noreply.github.com> Date: Fri, 24 Jul 2020 23:15:39 +0430 Subject: [PATCH] add target siteId to asset find query it seems after feed-me create an asset, it always find element for primary site id. so if target site Id is not primary site, it add/updates element for wrong site. for example https://github.com/craftcms/feed-me/issues/658 has same scenario. this PR add siteId of target site to criteria to find correct element record after asset creation. --- src/elements/Asset.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/elements/Asset.php b/src/elements/Asset.php index ca3f04c8..830aa912 100644 --- a/src/elements/Asset.php +++ b/src/elements/Asset.php @@ -140,6 +140,7 @@ private function _handleImageCreation($event) ->folderId($folderId) ->filename($filename) ->includeSubfolders(true) + ->siteId($feed['siteId']) ->one(); if ($foundElement) { @@ -154,6 +155,7 @@ private function _handleImageCreation($event) if ($uploadedElementIds) { $foundElement = AssetElement::find() ->id($uploadedElementIds[0]) + ->siteId($feed['siteId']) ->one(); if ($foundElement) {