From 9f8f188d928b47503d39348c5990379a572b570a Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 18 Dec 2018 13:14:42 +0100 Subject: Validate imported entry to avoid error on import We got some imports with a missing `url` field generating some errors while trying to retrieve an existing entry with that url. Introducing the `validateEntry` allow us to dismiss a message when it doesn't have an url (or other missing stuff in the future) --- src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php') diff --git a/src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php b/src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php index b035f5cc..e4bfbdf0 100644 --- a/src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php +++ b/src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php @@ -52,6 +52,13 @@ abstract class AbstractConsumer $this->import->setUser($user); + if (false === $this->import->validateEntry($storedEntry)) { + $this->logger->warning('Entry is invalid', ['entry' => $storedEntry]); + + // return true to skip message + return true; + } + $entry = $this->import->parseEntry($storedEntry); if (null === $entry) { -- cgit v1.2.3