Baboo7 / strapi-plugin-import-export-entries

Import/Export data from and to your database in just few clicks.
175 stars 86 forks source link

[BUG] Import media with csv - invalid data format 'number' #164

Open daroldso opened 8 months ago

daroldso commented 8 months ago

Describe the bug When importing data with JSON, I can use number to represent the id of the media. But when I try to import data with csv using number as the media id, I got the following error.

[
  {
    "error": "Invalid data format 'number' to import media. Only 'string', 'number', 'object' are accepted.",
    "data": {
      "name": "Test 2",
      "photo": 4
    }
  }
]

From the error, it seems the plugin recognise the media field is using a number, but it still returns an error saying it is invalid format, while saying number is an accepted format. So what should be the correct way to represent the id of the media?

I understand import with CSV is deprecated. So I hope to know is it really a bug, or I was doing it wrong.

To Reproduce Steps to reproduce the behavior:

  1. Add a collection type with a media field
  2. Import data using csv and use media id for the media column
  3. See error: Invalid data format 'number' to import media. Only 'string', 'number', 'object' are accepted.

Expected behavior When importing media with csv, number should be accepted as a representation of media id.

Additional context I am using the latest 1.23.1 version of the plugin

laurentmeyer commented 7 months ago

same here, it was introduced in this commit on the file src/server/services/import/utils/file.ts

I reverted to 1.20.0 to make my setup work

daroldso commented 7 months ago

@laurentmeyer Thanks. I reverted to 1.22.0 and it works.

@Baboo7 Is there any plan to add back the handling of number format?