]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Helper/ContentProxy.php
Merge pull request #3909 from wallabag/fix/html-not-defined
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Helper / ContentProxy.php
index a93f4a2d65eafde8dca1d87fbe202b0c21fe0035..31953f12d3ef947babfdd1d860c63939d3643abc 100644 (file)
@@ -256,18 +256,17 @@ class ContentProxy
             $entry->setTitle($content['open_graph']['og_title']);
         }
 
-        $html = $content['html'];
-        if (false === $html) {
-            $html = $this->fetchingErrorMessage;
+        if (empty($content['html'])) {
+            $content['html'] = $this->fetchingErrorMessage;
 
             if (!empty($content['open_graph']['og_description'])) {
-                $html .= '<p><i>But we found a short description: </i></p>';
-                $html .= $content['open_graph']['og_description'];
+                $content['html'] .= '<p><i>But we found a short description: </i></p>';
+                $content['html'] .= $content['open_graph']['og_description'];
             }
         }
 
-        $entry->setContent($html);
-        $entry->setReadingTime(Utils::getReadingTime($html));
+        $entry->setContent($content['html']);
+        $entry->setReadingTime(Utils::getReadingTime($content['html']));
 
         if (!empty($content['status'])) {
             $entry->setHttpStatus($content['status']);
@@ -349,6 +348,7 @@ class ContentProxy
 
         if ($this->ignoreUrl($entry->getUrl())) {
             $entry->setUrl($url);
+
             return false;
         }
 
@@ -360,7 +360,7 @@ class ContentProxy
          * 'only the path is different between the two urls' whereas
          * ['fragment', 'query'] means 'only fragment and query string parts are
          * different between the two urls'.
-         * 
+         *
          * Note that values in $diff_keys are sorted.
          */
         switch ($diff_keys) {
@@ -374,8 +374,6 @@ class ContentProxy
                 $entry->setUrl($url);
                 break;
             case ['fragment']:
-            case ['query']:
-            case ['fragment', 'query']:
                 // noop
                 break;
             default: