]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Prevent undefined index when import fetching fails
authorJerome Charaoui <jerome@riseup.net>
Sat, 3 Dec 2016 03:45:04 +0000 (22:45 -0500)
committerJerome Charaoui <jerome@riseup.net>
Sat, 3 Dec 2016 03:45:04 +0000 (22:45 -0500)
src/Wallabag/CoreBundle/Helper/ContentProxy.php

index 642ba6f9cad9eff9945463c7e8d949a73adad71d..2690edbe080fe4916e22329f0d24ec4006de8ce2 100644 (file)
@@ -76,8 +76,8 @@ class ContentProxy
         $entry->setContent($html);
         $entry->setHttpStatus(isset($content['status']) ? $content['status'] : '');
 
-        $entry->setLanguage($content['language']);
-        $entry->setMimetype($content['content_type']);
+        $entry->setLanguage(isset($content['language']) ? $content['language'] : '');
+        $entry->setMimetype(isset($content['content_type']) ? $content['content_type'] : '');
         $entry->setReadingTime(Utils::getReadingTime($html));
 
         $domainName = parse_url($entry->getUrl(), PHP_URL_HOST);
@@ -90,7 +90,7 @@ class ContentProxy
         }
 
         // if content is an image define as a preview too
-        if (in_array($this->mimeGuesser->guess($content['content_type']), ['jpeg', 'jpg', 'gif', 'png'], true)) {
+        if (isset($content['content_type']) && in_array($this->mimeGuesser->guess($content['content_type']), ['jpeg', 'jpg', 'gif', 'png'], true)) {
             $entry->setPreviewPicture($content['url']);
         }