mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-16 10:22:14 +01:00
Retain imported content if fetching fails, fixes #2658
This commit is contained in:
parent
1093e979ff
commit
29dca43236
@ -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'];
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user