Skip to content

Commit 2d2fbeb

Browse files
authored
Merge branch 'develop' into feature/2927-fixes
2 parents fbddfaf + 09cabdb commit 2d2fbeb

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ All notable changes to this project will be documented in this file.
66

77
- [#235](https://github.com/os2display/display-api-service/pull/234)
88
- Fixed Eventdatabasen v2 subscription data order by using occurrences endpoint.
9+
- [#236](https://github.com/os2display/display-api-service/pull/236)
10+
- Fixed bug where no media url made Notified feed crash.
911
- [#231](https://github.com/os2display/display-api-service/pull/231)
1012
- Adds new feed source: Eventdatabasen v2.
1113
- [#233](https://github.com/os2display/display-api-service/pull/233)

src/Feed/NotifiedFeedType.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,19 @@ public function getData(Feed $feed): array
5454

5555
$result = [];
5656

57-
// Check that image is accessible, otherwise leave out the feed element.
57+
// Check that image is available and accessible, otherwise leave out the feed element.
5858
foreach ($feedItems as $feedItem) {
59-
$response = $this->client->request(Request::METHOD_HEAD, $feedItem['mediaUrl']);
60-
$statusCode = $response->getStatusCode();
61-
62-
if (200 == $statusCode) {
63-
$result[] = $feedItem;
59+
if (!empty($feedItem['mediaUrl'])) {
60+
try {
61+
$response = $this->client->request(Request::METHOD_HEAD, $feedItem['mediaUrl']);
62+
$statusCode = $response->getStatusCode();
63+
64+
if (200 === $statusCode) {
65+
$result[] = $feedItem;
66+
}
67+
} catch (\Exception) {
68+
// Ignore item if request fails.
69+
}
6470
}
6571
}
6672

0 commit comments

Comments
 (0)