From 41ea6c3b29bbed97ac70908aaf8499caca313b30 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Sun, 21 May 2017 17:19:38 +0100 Subject: [PATCH] Fix issue #51 --- app/Http/Controllers/NotesController.php | 10 +++++++--- changelog.md | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/NotesController.php b/app/Http/Controllers/NotesController.php index 43b3b6e4..d576de0e 100644 --- a/app/Http/Controllers/NotesController.php +++ b/app/Http/Controllers/NotesController.php @@ -112,9 +112,13 @@ class NotesController extends Controller case 'in-reply-to': $content['source'] = $webmention->source; if (isset($microformats['items'][0]['properties']['published'][0])) { - $content['date'] = $carbon->parse( - $microformats['items'][0]['properties']['published'][0] - )->toDayDateTimeString(); + try { + $content['date'] = $carbon->parse( + $microformats['items'][0]['properties']['published'][0] + )->toDayDateTimeString(); + } catch (\Exception $exception) { + $content['date'] = $webmention->updated_at->toDayDateTimeString(); + } } else { $content['date'] = $webmention->updated_at->toDayDateTimeString(); } diff --git a/changelog.md b/changelog.md index e4f9c44f..755c586d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # Changelog +## Version 0.5.8 (2017-05-21) + - Hotfix: if Carbon can’t parse the supplied published date of a webmention, use the Model’s `updated_at` value + ## Version 0.5.7 (2017-05-19) - Hotfix: make sure `mpSyndicateTo` variable exists when accessed in if statements