craftcms / feed-me

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

Same image added to multiple Matrix blocks when using 'Use this filename for assets created from URL' #1471

Open tommysvr opened 5 days ago

tommysvr commented 5 days ago

Description

When opting to rename files during the import, only the first image in each array is imported, and that is duplicated across multiple Matrix Blocks.

Steps to reproduce

  1. Create a Matrix field/block type with an image field
  2. Using the example feed below, set up Feed Me to import into the image field inside Matrix
  3. Ensure 'Use this filename for assets created from URL' is using the filename
  4. Imported entry will show the same image twice: screenshot_2024_06_28 _10 25

This feature was added here: https://github.com/craftcms/feed-me/pull/1336

Additional info

Example Feed:

{
  "items": [
    {
      "title": "Entry 1",
      "images": [
        {
          "url": "https://via.placeholder.com/150",
          "filename": "image1"
        },
        {
          "url": "https://via.placeholder.com/200",
          "filename": "image2"
        }
      ]
    },
    {
      "title": "Entry 2",
      "images": [
        {
          "url": "https://via.placeholder.com/250",
          "filename": "image3"
        },
        {
          "url": "https://via.placeholder.com/300",
          "filename": "image4"
        }
      ]
    }
  ]
}
i-just commented 5 days ago

Thanks for a clear description, Tommy! PR raised.