From 29dca43236001221be947179df0caa8aee966f6d Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Fri, 2 Dec 2016 22:41:35 -0500 Subject: [PATCH 1/9] Retain imported content if fetching fails, fixes #2658 --- src/Wallabag/CoreBundle/Helper/ContentProxy.php | 9 +++++++-- src/Wallabag/CoreBundle/Resources/config/services.yml | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index fd0593254..77acbd6c2 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php @@ -21,14 +21,16 @@ class ContentProxy protected $logger; protected $tagRepository; protected $mimeGuesser; + protected $fetchingErrorMessage; - public function __construct(Graby $graby, RuleBasedTagger $tagger, TagRepository $tagRepository, LoggerInterface $logger) + public function __construct(Graby $graby, RuleBasedTagger $tagger, TagRepository $tagRepository, LoggerInterface $logger, $fetchingErrorMessage) { $this->graby = $graby; $this->tagger = $tagger; $this->logger = $logger; $this->tagRepository = $tagRepository; $this->mimeGuesser = new MimeTypeExtensionGuesser(); + $this->fetchingErrorMessage = $fetchingErrorMessage; } /** @@ -48,7 +50,10 @@ class ContentProxy { // do we have to fetch the content or the provided one is ok? if (empty($content) || false === $this->validateContent($content)) { - $content = $this->graby->fetchContent($url); + $fetchedContent = $this->graby->fetchContent($url); + if (empty($content) || $fetchedContent['html'] !== $this->fetchingErrorMessage) { + $content = $fetchedContent; + } } $title = $content['title']; diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index bcf0c9cab..fadd5e490 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml @@ -86,6 +86,7 @@ services: - "@wallabag_core.rule_based_tagger" - "@wallabag_core.tag_repository" - "@logger" + - '%wallabag_core.fetching_error_message%' wallabag_core.rule_based_tagger: class: Wallabag\CoreBundle\Helper\RuleBasedTagger From 36e6ef52a176ef654eade931a23f60fd91344f2f Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Fri, 2 Dec 2016 22:42:36 -0500 Subject: [PATCH 2/9] Imported entries which fail to fetch get standard error body --- src/Wallabag/CoreBundle/Helper/ContentProxy.php | 2 +- src/Wallabag/ImportBundle/Import/ChromeImport.php | 2 +- src/Wallabag/ImportBundle/Import/FirefoxImport.php | 2 +- src/Wallabag/ImportBundle/Import/InstapaperImport.php | 1 + src/Wallabag/ImportBundle/Import/ReadabilityImport.php | 1 + 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index 77acbd6c2..642ba6f9c 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php @@ -63,7 +63,7 @@ class ContentProxy $html = $content['html']; if (false === $html) { - $html = '

Unable to retrieve readable content.

'; + $html = $this->fetchingErrorMessage; if (isset($content['open_graph']['og_description'])) { $html .= '

But we found a short description:

'; diff --git a/src/Wallabag/ImportBundle/Import/ChromeImport.php b/src/Wallabag/ImportBundle/Import/ChromeImport.php index d7620bcb7..1a3249349 100644 --- a/src/Wallabag/ImportBundle/Import/ChromeImport.php +++ b/src/Wallabag/ImportBundle/Import/ChromeImport.php @@ -37,7 +37,7 @@ class ChromeImport extends BrowserImport { $data = [ 'title' => $entry['name'], - 'html' => '', + 'html' => false, 'url' => $entry['url'], 'is_archived' => $this->markAsRead, 'tags' => '', diff --git a/src/Wallabag/ImportBundle/Import/FirefoxImport.php b/src/Wallabag/ImportBundle/Import/FirefoxImport.php index e010f5a46..d3f997703 100644 --- a/src/Wallabag/ImportBundle/Import/FirefoxImport.php +++ b/src/Wallabag/ImportBundle/Import/FirefoxImport.php @@ -37,7 +37,7 @@ class FirefoxImport extends BrowserImport { $data = [ 'title' => $entry['title'], - 'html' => '', + 'html' => false, 'url' => $entry['uri'], 'is_archived' => $this->markAsRead, 'tags' => '', diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index cf4c785ce..146a8c7c4 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php @@ -76,6 +76,7 @@ class InstapaperImport extends AbstractImport 'is_starred' => $data[3] === 'Starred', 'content_type' => '', 'language' => '', + 'html' => false, ]; } fclose($handle); diff --git a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php index b8c0f7770..66b008850 100644 --- a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php +++ b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php @@ -103,6 +103,7 @@ class ReadabilityImport extends AbstractImport 'is_archived' => $importedEntry['archive'] || $this->markAsRead, 'is_starred' => $importedEntry['favorite'], 'created_at' => $importedEntry['date_added'], + 'html' => false, ]; $entry = new Entry($this->user); From e858018fdd82b26bfef00e92398ce7462264c4c4 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Fri, 2 Dec 2016 22:45:04 -0500 Subject: [PATCH 3/9] Prevent undefined index when import fetching fails --- src/Wallabag/CoreBundle/Helper/ContentProxy.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index 642ba6f9c..2690edbe0 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php @@ -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']); } From 3cd6da0b749bd136758add109ed30531be224f4a Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Fri, 2 Dec 2016 23:55:30 -0500 Subject: [PATCH 4/9] Allow fetching content on all import types For better consistency, allow all types of imported entries to update, which was already the case for Firefox and Chrome. --- src/Wallabag/ImportBundle/Import/InstapaperImport.php | 2 -- src/Wallabag/ImportBundle/Import/PinboardImport.php | 2 -- src/Wallabag/ImportBundle/Import/ReadabilityImport.php | 2 -- src/Wallabag/ImportBundle/Import/WallabagV1Import.php | 2 -- 4 files changed, 8 deletions(-) diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php index 146a8c7c4..70a53f1af 100644 --- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php +++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php @@ -74,8 +74,6 @@ class InstapaperImport extends AbstractImport 'status' => $data[3], 'is_archived' => $data[3] === 'Archive' || $data[3] === 'Starred', 'is_starred' => $data[3] === 'Starred', - 'content_type' => '', - 'language' => '', 'html' => false, ]; } diff --git a/src/Wallabag/ImportBundle/Import/PinboardImport.php b/src/Wallabag/ImportBundle/Import/PinboardImport.php index 9bcfbc369..d9865534a 100644 --- a/src/Wallabag/ImportBundle/Import/PinboardImport.php +++ b/src/Wallabag/ImportBundle/Import/PinboardImport.php @@ -98,8 +98,6 @@ class PinboardImport extends AbstractImport $data = [ 'title' => $importedEntry['description'], 'url' => $importedEntry['href'], - 'content_type' => '', - 'language' => '', 'is_archived' => ('no' === $importedEntry['toread']) || $this->markAsRead, 'is_starred' => false, 'created_at' => $importedEntry['time'], diff --git a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php index 66b008850..de320d239 100644 --- a/src/Wallabag/ImportBundle/Import/ReadabilityImport.php +++ b/src/Wallabag/ImportBundle/Import/ReadabilityImport.php @@ -98,8 +98,6 @@ class ReadabilityImport extends AbstractImport $data = [ 'title' => $importedEntry['article__title'], 'url' => $importedEntry['article__url'], - 'content_type' => '', - 'language' => '', 'is_archived' => $importedEntry['archive'] || $this->markAsRead, 'is_starred' => $importedEntry['favorite'], 'created_at' => $importedEntry['date_added'], diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php index 4f0010624..59e3ce026 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php @@ -37,8 +37,6 @@ class WallabagV1Import extends WallabagImport 'title' => $entry['title'], 'html' => $entry['content'], 'url' => $entry['url'], - 'content_type' => '', - 'language' => '', 'is_archived' => $entry['is_read'] || $this->markAsRead, 'is_starred' => $entry['is_fav'], 'tags' => '', From fc2b7bda53f4dd66d193383983d48ca92016b5b3 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Fri, 2 Dec 2016 23:59:18 -0500 Subject: [PATCH 5/9] Fix ContentProxy tests --- .../CoreBundle/Helper/ContentProxyTest.php | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php index 33b3ff2a5..55e4d506c 100644 --- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php @@ -1,14 +1,15 @@ '', ]); - $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); + $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); $entry = $proxy->updateEntry(new Entry(new User()), 'http://user@:80'); $this->assertEquals('http://user@:80', $entry->getUrl()); $this->assertEmpty($entry->getTitle()); - $this->assertEquals('

Unable to retrieve readable content.

', $entry->getContent()); + $this->assertEquals($this->fetchingErrorMessage, $entry->getContent()); $this->assertEmpty($entry->getPreviewPicture()); $this->assertEmpty($entry->getMimetype()); $this->assertEmpty($entry->getLanguage()); @@ -65,12 +66,12 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase 'language' => '', ]); - $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); + $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); $this->assertEquals('http://0.0.0.0', $entry->getUrl()); $this->assertEmpty($entry->getTitle()); - $this->assertEquals('

Unable to retrieve readable content.

', $entry->getContent()); + $this->assertEquals($this->fetchingErrorMessage, $entry->getContent()); $this->assertEmpty($entry->getPreviewPicture()); $this->assertEmpty($entry->getMimetype()); $this->assertEmpty($entry->getLanguage()); @@ -104,12 +105,12 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ], ]); - $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); + $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io'); $this->assertEquals('http://domain.io', $entry->getUrl()); $this->assertEquals('my title', $entry->getTitle()); - $this->assertEquals('

Unable to retrieve readable content.

But we found a short description:

desc', $entry->getContent()); + $this->assertEquals($this->fetchingErrorMessage . '

But we found a short description:

desc', $entry->getContent()); $this->assertEmpty($entry->getPreviewPicture()); $this->assertEmpty($entry->getLanguage()); $this->assertEmpty($entry->getHttpStatus()); @@ -145,7 +146,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ], ]); - $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); + $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); $this->assertEquals('http://1.1.1.1', $entry->getUrl()); @@ -167,7 +168,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase $graby = $this->getMockBuilder('Graby\Graby')->getMock(); - $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); + $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger(), $this->fetchingErrorMessage); $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [ 'html' => str_repeat('this is my content', 325), 'title' => 'this is my title', @@ -197,7 +198,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ->will($this->throwException(new \Exception())); $tagRepo = $this->getTagRepositoryMock(); - $proxy = new ContentProxy($graby, $tagger, $tagRepo, $this->getLogger()); + $proxy = new ContentProxy($graby, $tagger, $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [ 'html' => str_repeat('this is my content', 325), @@ -217,7 +218,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ->getMock(); $tagRepo = $this->getTagRepositoryMock(); - $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger()); + $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); $entry = new Entry(new User()); @@ -235,7 +236,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ->getMock(); $tagRepo = $this->getTagRepositoryMock(); - $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger()); + $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); $entry = new Entry(new User()); @@ -253,7 +254,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ->getMock(); $tagRepo = $this->getTagRepositoryMock(); - $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger()); + $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); $entry = new Entry(new User()); @@ -269,7 +270,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ->getMock(); $tagRepo = $this->getTagRepositoryMock(); - $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger()); + $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); $entry = new Entry(new User()); @@ -285,7 +286,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ->getMock(); $tagRepo = $this->getTagRepositoryMock(); - $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger()); + $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); $tagEntity = new Tag(); $tagEntity->setLabel('tag1'); @@ -310,7 +311,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase $tagRepo->expects($this->never()) ->method('__call'); - $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger()); + $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger(), $this->fetchingErrorMessage); $tagEntity = new Tag(); $tagEntity->setLabel('tag1'); From dba1e0b1883e32005fc7f980b5206dc5eb078e29 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Fri, 2 Dec 2016 23:59:43 -0500 Subject: [PATCH 6/9] Fix WallabagV1Controller test Account for URL redirection in refreshed entry. --- .../ImportBundle/Controller/WallabagV1ControllerTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php index 2c370ed99..acc399979 100644 --- a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php @@ -112,7 +112,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase ->get('doctrine.orm.entity_manager') ->getRepository('WallabagCoreBundle:Entry') ->findByUrlAndUserId( - 'http://www.framablog.org/index.php/post/2014/02/05/Framabag-service-libre-gratuit-interview-developpeur', + 'https://framablog.org/2014/02/05/framabag-service-libre-gratuit-interview-developpeur/', $this->getLoggedInUserId() ); @@ -126,9 +126,9 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text'])); $this->assertContains('flashes.import.notice.summary', $body[0]); - $this->assertEmpty($content->getMimetype(), 'Mimetype for http://www.framablog.org is ok'); - $this->assertEmpty($content->getPreviewPicture(), 'Preview picture for http://www.framablog.org is ok'); - $this->assertEmpty($content->getLanguage(), 'Language for http://www.framablog.org is ok'); + $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.framablog.org is ok'); + $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.framablog.org is ok'); + $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.framablog.org is ok'); $this->assertEquals(1, count($content->getTags())); $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); } From cd82ace70a9fede70f44f7f11c05456118b36b04 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Sat, 3 Dec 2016 00:26:57 -0500 Subject: [PATCH 7/9] Add missing CoreKernelTestCase class --- .../Wallabag/CoreBundle/CoreKernelTestCase.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/Wallabag/CoreBundle/CoreKernelTestCase.php diff --git a/tests/Wallabag/CoreBundle/CoreKernelTestCase.php b/tests/Wallabag/CoreBundle/CoreKernelTestCase.php new file mode 100644 index 000000000..d14421f13 --- /dev/null +++ b/tests/Wallabag/CoreBundle/CoreKernelTestCase.php @@ -0,0 +1,17 @@ +getContainer(); + $this->fetchingErrorMessage = $container->getParameter('wallabag_core.fetching_error_message'); + } +} From a2c1b94e8200260c1d6172ec2c36ef9a0e956d02 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Sat, 3 Dec 2016 09:44:34 -0500 Subject: [PATCH 8/9] Revert switch to KernelTestCase for ContentProxyTest Define the error string manually inside the test class instead of fetching it from app config. --- .../Wallabag/CoreBundle/CoreKernelTestCase.php | 17 ----------------- .../CoreBundle/Helper/ContentProxyTest.php | 7 ++++--- 2 files changed, 4 insertions(+), 20 deletions(-) delete mode 100644 tests/Wallabag/CoreBundle/CoreKernelTestCase.php diff --git a/tests/Wallabag/CoreBundle/CoreKernelTestCase.php b/tests/Wallabag/CoreBundle/CoreKernelTestCase.php deleted file mode 100644 index d14421f13..000000000 --- a/tests/Wallabag/CoreBundle/CoreKernelTestCase.php +++ /dev/null @@ -1,17 +0,0 @@ -getContainer(); - $this->fetchingErrorMessage = $container->getParameter('wallabag_core.fetching_error_message'); - } -} diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php index 55e4d506c..2ca13b914 100644 --- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php @@ -1,16 +1,17 @@ troubleshoot this issue.'; + public function testWithBadUrl() { $tagger = $this->getTaggerMock(); From 106bdbcd0ab6c75937188dfce243167b878e9a8c Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 4 Dec 2016 11:27:49 +0100 Subject: [PATCH 9/9] Add some comments --- src/Wallabag/CoreBundle/Helper/ContentProxy.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index 2690edbe0..0130bd2b2 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php @@ -51,6 +51,9 @@ class ContentProxy // do we have to fetch the content or the provided one is ok? if (empty($content) || false === $this->validateContent($content)) { $fetchedContent = $this->graby->fetchContent($url); + + // when content is imported, we have information in $content + // in case fetching content goes bad, we'll keep the imported information instead of overriding them if (empty($content) || $fetchedContent['html'] !== $this->fetchingErrorMessage) { $content = $fetchedContent; }