fix: don't crash if a duplicate is found on search and episode
This commit is contained in:
parent
80844d8ac0
commit
f17e795004
@ -34,7 +34,7 @@ class EpisodesController extends Controller
|
||||
$episodes = $this->episodeActionReader->parseRssXml((string) $feed->getBody());
|
||||
|
||||
usort($episodes, fn (EpisodeActionExtraData $a, EpisodeActionExtraData $b) => $b->getPubDate() <=> $a->getPubDate());
|
||||
$episodes = array_intersect_key($episodes, array_unique(array_map(fn (EpisodeActionExtraData $episode) => $episode->getGuid(), $episodes)));
|
||||
$episodes = array_values(array_intersect_key($episodes, array_unique(array_map(fn (EpisodeActionExtraData $episode) => $episode->getGuid(), $episodes))));
|
||||
|
||||
return new JSONResponse($episodes, $feed->getStatusCode());
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class SearchController extends Controller
|
||||
}
|
||||
|
||||
usort($podcasts, fn (PodcastData $a, PodcastData $b) => $b->getFetchedAtUnix() <=> $a->getFetchedAtUnix());
|
||||
$podcasts = array_intersect_key($podcasts, array_unique(array_map(fn (PodcastData $feed) => $feed->getLink(), $podcasts)));
|
||||
$podcasts = array_values(array_intersect_key($podcasts, array_unique(array_map(fn (PodcastData $feed) => $feed->getLink(), $podcasts))));
|
||||
|
||||
return new JSONResponse($podcasts);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user