Forums » CSV Import halts at an empty file field

RSS feed for this topic

Info

  • Posted in Plugins
  • Started 3 years ago by ig
  • 4 posts by 2 users
  • Latest reply from wanderingwill
  1. I've just been importing some CSV data, including one file column. Which all works beautifully, except that the import process stops and throws an error if that column contains any empty fields: it appears not to notice that it's a blank value and submits it to the processing code regardless.

    I've solved this by hacking the models/CSVImport/Import.php script in the plugin folder, changing line #251:

    if (!in_array($urlForFile, $urlsForFiles)) {

    to:

    if ((!in_array($urlForFile, $urlsForFiles)) && ($urlForFile != "")) {

    ...which seems to work fine.

    Just thought I'd document the hack in case it's useful to anyone else.

  2. Thanks ig, I'll look into this.

  3. Also, can you post the smallest sample of your csv file that causes this error?

  4. Ok, I was able to reproduce the issue. The error message is "URL is not readable or does not exist: ". Technically, this is correct because the plugin was not able to download a file from an empty URL. However, I see that this would be problematic if some items that you are trying to import from the csv file have no files to download, it would always throw this error. So I think your solution is correct, and I will add it to the next release of CsvImport. Thank you for finding this.

Reply

You must log in to post.