Ignore 404 url in Feeds on Drupal 9

Today's note is how to make the feeds module ignore links to unfound image files. By default, if feeds does not find an image at the url specified in the csv file, the import process stops and an error is generated. However, if we just need to skip the file not found and continue importing without it, the problem begins.

Initially, there were no settings to skip not found files in feeds, but a patch was found on drupal.org that will help fix the situation.

As usual, in the attachment is the patch itself and below its text.

diff --git a/media_feeds.module b/media_feeds.module
index 5821175..8496d96 100644
--- a/media_feeds.module
+++ b/media_feeds.module
@@ -180,6 +180,8 @@ function media_feeds_set_target($source, $entity, $target, $values, $config = ar
       drupal_set_message($e->getMessage(), 'error');
     } catch (MediaInternetValidationException $e) {
       drupal_set_message($e->getMessage(), 'error');
+    } catch (Exception $e) {
+      drupal_set_message($e->getMessage(), 'error');
     }
   }

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
The comment language code.