Download & Extend

Prevent further processing and watchdog msg if URL is empty for whatever reason

Project:Feeds Image Grabber
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

If the $page_url in feeds_imagegrabber_feeds_set_target($node, $target, $page_url) is empty, FIG still goes through the process of validating etc, eventually firing a watchdog message "Input to field was not a valid URL".

Would it be ok to bail out earlier?

The reason this comes up for me is a very particular use case, but logically I think it still makes sense.

In my case many of the feed items will have a default image if nothing better is available. If I'd just let feeds and FIG do its thing, I would end up with thousands of copies of the same image. Hence I check for this default image in hook_feeds_after_parse() and replace the default image with an empty string. Since imagefield gives the option to have its own default image, this works well.

But I get a lot of unnecessary watchdog writes from this and FIG does more work than it needs to. Mini patch follows...

Comments

#1

AttachmentSize
bail_if_url_empty-1082128-1.patch 881 bytes

#2

I have no problem, but can you explain why is $page_url empty? I would rather replace it with valid_url($page_url), works for you?

#3

Hm, it's been a while since I tinkered with this. But isn't it quite possible to be empty for items in a feed in general? The feed I used at the time had only an image for about 1 in 5 items....and it seems to be unnecessary to check whether something that's empty is a valid URL. But up to you, of course...