Fixes #6963 -- Escape cache keys for Now Playing so special characters don't cause problems.

This commit is contained in:
Buster Neece 2024-03-02 15:29:33 -06:00
parent b83d54bf50
commit 2e169b9499
No known key found for this signature in database
4 changed files with 11 additions and 5 deletions

View File

@ -157,7 +157,9 @@ final class NowPlayingCache
} }
return $this->cache->getItem( return $this->cache->getItem(
'now_playing.station_' . $identifier urlencode(
'now_playing.station_' . $identifier
)
); );
} }
} }

View File

@ -106,7 +106,7 @@ final class SingleTaskCommand extends AbstractSyncCommand
*/ */
public static function getCacheKey(string $taskClass): string public static function getCacheKey(string $taskClass): string
{ {
return 'sync_last_run.' . self::getClassShortName($taskClass); return urlencode('sync_last_run.' . self::getClassShortName($taskClass));
} }
/** /**

View File

@ -65,7 +65,11 @@ final class ListAction extends AbstractSearchableListAction
private function getPlaylists( private function getPlaylists(
Station $station Station $station
): array { ): array {
$item = $this->psr6Cache->getItem('station_' . $station->getIdRequired() . '_on_demand_playlists'); $item = $this->psr6Cache->getItem(
urlencode(
'station_' . $station->getIdRequired() . '_on_demand_playlists'
)
);
if (!$item->isHit()) { if (!$item->isHit()) {
$playlistIds = $this->em->createQuery( $playlistIds = $this->em->createQuery(

View File

@ -81,7 +81,7 @@ final class ScheduleAction implements SingleActionInterface
. $dateRange->getStart()->format('Ymd') . '-' . $dateRange->getStart()->format('Ymd') . '-'
. $dateRange->getEnd()->format('Ymd'); . $dateRange->getEnd()->format('Ymd');
$cacheItem = $this->psr6Cache->getItem($cacheKey); $cacheItem = $this->psr6Cache->getItem(urlencode($cacheKey));
if (!$cacheItem->isHit()) { if (!$cacheItem->isHit()) {
$nowTz = CarbonImmutable::now($station->getTimezoneObject()); $nowTz = CarbonImmutable::now($station->getTimezoneObject());
@ -113,7 +113,7 @@ final class ScheduleAction implements SingleActionInterface
$cacheKey = 'api_station_' . $station->getId() . '_schedule_upcoming'; $cacheKey = 'api_station_' . $station->getId() . '_schedule_upcoming';
} }
$cacheItem = $this->psr6Cache->getItem($cacheKey); $cacheItem = $this->psr6Cache->getItem(urlencode($cacheKey));
if (!$cacheItem->isHit()) { if (!$cacheItem->isHit()) {
$cacheItem->set($this->scheduleRepo->getUpcomingSchedule($station, $now)); $cacheItem->set($this->scheduleRepo->getUpcomingSchedule($station, $now));