]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/ImportBundle/Import/WallabagImport.php
Validate imported entry to avoid error on import
[github/wallabag/wallabag.git] / src / Wallabag / ImportBundle / Import / WallabagImport.php
index 0e5382cfe8a7e28a2a76f172add9a46ab6785201..350d06001f12202f6c6678b01b5f48da19773ace 100644 (file)
@@ -86,6 +86,18 @@ abstract class WallabagImport extends AbstractImport
         return $this;
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    public function validateEntry(array $importedEntry)
+    {
+        if (empty($importedEntry['url'])) {
+            return false;
+        }
+
+        return true;
+    }
+
     /**
      * {@inheritdoc}
      */
@@ -108,7 +120,7 @@ abstract class WallabagImport extends AbstractImport
         $entry->setTitle($data['title']);
 
         // update entry with content (in case fetching failed, the given entry will be return)
-        $entry = $this->fetchContent($entry, $data['url'], $data);
+        $this->fetchContent($entry, $data['url'], $data);
 
         if (array_key_exists('tags', $data)) {
             $this->tagsAssigner->assignTagsToEntry(