craftcms / feed-me

Craft CMS plugin for importing entry data from XML, RSS or ATOM feeds—routine task or on-demand.
Other
285 stars 139 forks source link

[Craft 5] Asset Location setting has an invalid subpath with Matrix/Neo fields #1477

Open lucasdaniels opened 3 weeks ago

lucasdaniels commented 3 weeks ago

Description

When trying to import an asset in to an image field through FeedMe to a Matrix (or Neo) field it throws an error: Asset Location setting has an invalid subpath handbooks/{owner.slug}. This was initially a Neo field, which throws the same error, but I have converted this using the built-in Neo to Matrix converter in to a Matrix field.

When manually creating an entry and adding an asset to the Matrix (or Neo) it works and the image is saved in the correct location.

Good thing to note is that the assets are hosted via Servd Asset - the machine is local (DDEV), but assets are saved on their asset platform. The "Send Feed Me logs to Craft's standard log output so that they can be collected and displayed by Servd." option is checked in the settings of the Servd Assets and Helpers plugin.

Stracktrace: `craft\errors\InvalidSubpathException: Could not resolve the subpath “handbooks/{owner.slug}”. in /var/www/html/vendor/craftcms/cms/src/fields/Assets.php:908 Stack trace:

0 /var/www/html/vendor/craftcms/cms/src/fields/Assets.php(1005): craft\fields\Assets->_findFolder('volume:446f5a99...', 'handbooks/{owne...', Object(craft\elements\Entry), true)

1 /var/www/html/vendor/craftcms/cms/src/fields/Assets.php(453): craft\fields\Assets->_uploadFolder(Object(craft\elements\Entry))

2 /var/www/html/vendor/craftcms/feed-me/src/fields/Assets.php(94): craft\fields\Assets->resolveDynamicPathToFolderId(Object(craft\elements\Entry))

3 /var/www/html/vendor/spicyweb/craft-neo/src/integrations/feedme/Field.php(288): craft\feedme\fields\Assets->parseField()

4 /var/www/html/vendor/spicyweb/craft-neo/src/integrations/feedme/Field.php(156): benf\neo\integrations\feedme\Field->_parseSubField(Array, 'handbookSingleI...', Array)

5 /var/www/html/vendor/craftcms/feed-me/src/services/Fields.php(234): benf\neo\integrations\feedme\Field->parseField()

6 /var/www/html/vendor/craftcms/feed-me/src/services/Process.php(405): craft\feedme\services\Fields->parseField(Array, Object(craft\elements\Entry), Array, 'bodyTextNeoHand...', Array)

7 /var/www/html/vendor/craftcms/feed-me/src/services/Process.php(624): craft\feedme\services\Process->processFeed(0, Array, Array)

8 /var/www/html/vendor/craftcms/feed-me/src/controllers/FeedsController.php(296): craft\feedme\services\Process->debugFeed(Object(craft\feedme\models\FeedModel), NULL, NULL, Array)

9 [internal function]: craft\feedme\controllers\FeedsController->actionDebug()

10 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)

11 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)

12 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('debug', Array)

13 /var/www/html/vendor/craftcms/cms/src/web/Application.php(349): yii\base\Module->runAction('feed-me/feeds/d...', Array)

14 /var/www/html/vendor/craftcms/cms/src/web/Application.php(650): craft\web\Application->runAction('feed-me/feeds/d...', Array)

15 /var/www/html/vendor/craftcms/cms/src/web/Application.php(311): craft\web\Application->_processActionRequest(Object(craft\web\Request))

16 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))

17 /var/www/html/web/index.php(12): yii\base\Application->run()

18 {main}

Next craft\errors\InvalidSubpathException: The Handbook Single Image field’s Asset Location setting has an invalid subpath (“handbooks/{owner.slug}”). in /var/www/html/vendor/craftcms/cms/src/fields/Assets.php:1025 Stack trace:

0 /var/www/html/vendor/craftcms/cms/src/fields/Assets.php(453): craft\fields\Assets->_uploadFolder(Object(craft\elements\Entry))

1 /var/www/html/vendor/craftcms/feed-me/src/fields/Assets.php(94): craft\fields\Assets->resolveDynamicPathToFolderId(Object(craft\elements\Entry))

2 /var/www/html/vendor/spicyweb/craft-neo/src/integrations/feedme/Field.php(288): craft\feedme\fields\Assets->parseField()

3 /var/www/html/vendor/spicyweb/craft-neo/src/integrations/feedme/Field.php(156): benf\neo\integrations\feedme\Field->_parseSubField(Array, 'handbookSingleI...', Array)

4 /var/www/html/vendor/craftcms/feed-me/src/services/Fields.php(234): benf\neo\integrations\feedme\Field->parseField()

5 /var/www/html/vendor/craftcms/feed-me/src/services/Process.php(405): craft\feedme\services\Fields->parseField(Array, Object(craft\elements\Entry), Array, 'bodyTextNeoHand...', Array)

6 /var/www/html/vendor/craftcms/feed-me/src/services/Process.php(624): craft\feedme\services\Process->processFeed(0, Array, Array)

7 /var/www/html/vendor/craftcms/feed-me/src/controllers/FeedsController.php(296): craft\feedme\services\Process->debugFeed(Object(craft\feedme\models\FeedModel), NULL, NULL, Array)

8 [internal function]: craft\feedme\controllers\FeedsController->actionDebug()

9 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)

10 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)

11 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('debug', Array)

12 /var/www/html/vendor/craftcms/cms/src/web/Application.php(349): yii\base\Module->runAction('feed-me/feeds/d...', Array)

13 /var/www/html/vendor/craftcms/cms/src/web/Application.php(650): craft\web\Application->runAction('feed-me/feeds/d...', Array)

14 /var/www/html/vendor/craftcms/cms/src/web/Application.php(311): craft\web\Application->_processActionRequest(Object(craft\web\Request))

15 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))

16 /var/www/html/web/index.php(12): yii\base\Application->run()

17 {main}`

Steps to reproduce

  1. Create a Matrix (or neo, tried both) field, with a dynamic subpath (e.g. handbooks/{owner.slug})
  2. Create FeedMe feed, with create asset from URL checked (settings)
  3. Debug/Import throws above error.

Additional info

lucasdaniels commented 2 weeks ago

The issue unfortunately also persists in FeedMe 6.2.0.