Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
FeedsParser throws an exception if http_get_request does not return 200 in getContent() method. However in getFile() method there's no try catch clause for that and it causes an error for instance in case you are requesting an image which does not exist and therefore the whole node creation fails.
Comments
Comment #1
vaartio CreditAttribution: vaartio commentedHere a patch for that.
Comment #2
vaartio CreditAttribution: vaartio commentedThere were problems applying the one above so here's the new one.
Comment #3
johnbarclay CreditAttribution: johnbarclay commentedThis turned out to be a big problem. In the case where the image url is empty or NULL those nodes do not import. Although the error message is clear, one has to create multiple feeds for the same entity. One for the other fields and one for the images.
This patch worked fine for me on 7.x-2.x head on Drupal 7.8. I also looked over the code in the patch and don't see any problems it would create.
Another patch should be written for the special case where the value of the file url is NULL or empty. The module should not request the file at all.
Comment #4
Dave ReidThis should probably be using watchdog_exception()?
Same here.
Comment #5
jedprentice CreditAttribution: jedprentice commentedI apologize if this question has an obvious answer, but could you provide a sample file and/or provide steps to reproduce? That would go a long way toward getting this patch reviewed, tested, and committed. So far I'm having trouble reproducing this issue based on the info provided.
Thanks,
Jed
Comment #6
bancarddata CreditAttribution: bancarddata commentedThe problem this patch is attempting to solve is if you run an import with an image field defined, and your source contains a path to an image that does not exist, the expected behavior would be to import the node without an image and log the fact that the image was not found. Currently, however, the whole node fails to import. This patch brings us the expected behavior.
I have tested on D7.12 and the latest dev copy of Feeds - working fine for me. Thank you vaartio.
Comment #7
bancarddata CreditAttribution: bancarddata commentedHere is a rerolled patch against the latest dev with the changes recommended in #4.
Comment #8
franzSome trailing whitespace to remove.
Comment #9
franzRe-rolled and cleaned.
Comment #10
franzComment #11
Fabianx CreditAttribution: Fabianx commentedCode should look like this:
Exception is second argument
Comment #12
franzFixed watchdog_exception() calls.
Comment #13
Anonymous (not verified) CreditAttribution: Anonymous commentedI had a CSV file with an image column. Some rows had images, others hadn't. Without this patch the rows without images would fail. Tested the patch on 7.x-2.0-alpha5 and it worked like a charm. Thanks!
Comment #14
geek-merlinComment #15
twistor CreditAttribution: twistor commented7.x http://drupalcode.org/project/feeds.git/commit/9e89fdf
Does this need a backport?