1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-09-15 18:57:05 +00:00

Fix empty title and domain_name when exception is thrown during fetch

Add a new helper to set a default title when it's empty:
1/ use basename part of entry's path, if any
2/ or use domain name

Fixes #2053

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
Kevin Decherf 2017-11-26 23:20:23 +01:00
parent 70265817ae
commit af29e1bf07
4 changed files with 59 additions and 4 deletions

View file

@ -381,6 +381,14 @@ class EntryRestController extends WallabagRestController
}
}
if (empty($entry->getDomainName())) {
$this->get('wallabag_core.content_proxy')->setEntryDomainName($entry);
}
if (empty($entry->getTitle())) {
$this->get('wallabag_core.content_proxy')->setDefaultEntryTitle($entry);
}
$em = $this->getDoctrine()->getManager();
$em->persist($entry);
$em->flush();
@ -490,6 +498,14 @@ class EntryRestController extends WallabagRestController
$entry->setOriginUrl($data['origin_url']);
}
if (empty($entry->getDomainName())) {
$this->get('wallabag_core.content_proxy')->setEntryDomainName($entry);
}
if (empty($entry->getTitle())) {
$this->get('wallabag_core.content_proxy')->setDefaultEntryTitle($entry);
}
$em = $this->getDoctrine()->getManager();
$em->persist($entry);
$em->flush();