diff options
author | adev <adev2000@gmail.com> | 2017-05-08 12:35:02 +0200 |
---|---|---|
committer | adev <adev2000@gmail.com> | 2017-05-08 14:57:25 +0200 |
commit | 08f29ae7b6af585f3af1dd2f8b01854fb0985668 (patch) | |
tree | 859985863551dcaf699a5b32a8e8d4afc45e7a78 /src | |
parent | f2beee5185e0bf7f983fb97a34480b4c74d7eb8c (diff) | |
download | wallabag-08f29ae7b6af585f3af1dd2f8b01854fb0985668.tar.gz wallabag-08f29ae7b6af585f3af1dd2f8b01854fb0985668.tar.zst wallabag-08f29ae7b6af585f3af1dd2f8b01854fb0985668.zip |
Create a new entry via API even when its content can't be retrieved
Fix #2988
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 2c2ec0c1..e9e1aca3 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php | |||
@@ -199,10 +199,19 @@ class EntryRestController extends WallabagRestController | |||
199 | $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($url, $this->getUser()->getId()); | 199 | $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($url, $this->getUser()->getId()); |
200 | 200 | ||
201 | if (false === $entry) { | 201 | if (false === $entry) { |
202 | $entry = $this->get('wallabag_core.content_proxy')->updateEntry( | 202 | $entry = new Entry($this->getUser()); |
203 | new Entry($this->getUser()), | 203 | try { |
204 | $url | 204 | $entry = $this->get('wallabag_core.content_proxy')->updateEntry( |
205 | ); | 205 | $entry, |
206 | $url | ||
207 | ); | ||
208 | } catch (\Exception $e) { | ||
209 | $this->get('logger')->error('Error while saving an entry', [ | ||
210 | 'exception' => $e, | ||
211 | 'entry' => $entry, | ||
212 | ]); | ||
213 | $entry->setUrl($url); | ||
214 | } | ||
206 | } | 215 | } |
207 | 216 | ||
208 | if (!is_null($title)) { | 217 | if (!is_null($title)) { |