diff options
author | Thomas Citharel <tcit@tcit.fr> | 2017-05-10 09:38:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-10 09:38:55 +0200 |
commit | 91ba9a59754b09f0713161567d36c959c2aa5ffe (patch) | |
tree | 20af15a35468b7fb2aadb2405d39bde3f71a5190 /src | |
parent | a2ae05a61ca7aad476a48247a4559c25dd55618d (diff) | |
parent | a9357a8311b2a3a9a114ec8400a9878d5f1f8345 (diff) | |
download | wallabag-91ba9a59754b09f0713161567d36c959c2aa5ffe.tar.gz wallabag-91ba9a59754b09f0713161567d36c959c2aa5ffe.tar.zst wallabag-91ba9a59754b09f0713161567d36c959c2aa5ffe.zip |
Merge pull request #3095 from aaa2000/api-error-on-fail-fetch-content
Create a new entry via API even when its content can't be retrieved
Diffstat (limited to 'src')
-rw-r--r-- | src/Wallabag/ApiBundle/Controller/EntryRestController.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index c544815e..54c1747c 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php | |||
@@ -200,10 +200,19 @@ class EntryRestController extends WallabagRestController | |||
200 | $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($url, $this->getUser()->getId()); | 200 | $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($url, $this->getUser()->getId()); |
201 | 201 | ||
202 | if (false === $entry) { | 202 | if (false === $entry) { |
203 | $entry = $this->get('wallabag_core.content_proxy')->updateEntry( | 203 | $entry = new Entry($this->getUser()); |
204 | new Entry($this->getUser()), | 204 | try { |
205 | $url | 205 | $entry = $this->get('wallabag_core.content_proxy')->updateEntry( |
206 | ); | 206 | $entry, |
207 | $url | ||
208 | ); | ||
209 | } catch (\Exception $e) { | ||
210 | $this->get('logger')->error('Error while saving an entry', [ | ||
211 | 'exception' => $e, | ||
212 | 'entry' => $entry, | ||
213 | ]); | ||
214 | $entry->setUrl($url); | ||
215 | } | ||
207 | } | 216 | } |
208 | 217 | ||
209 | if (!is_null($title)) { | 218 | if (!is_null($title)) { |