diff --git a/code/dataobjects/PodcastEpisode.php b/code/dataobjects/PodcastEpisode.php index e2f008b..8fcbfb5 100644 --- a/code/dataobjects/PodcastEpisode.php +++ b/code/dataobjects/PodcastEpisode.php @@ -128,8 +128,10 @@ public function getMime() { * @return string */ public function getType() { - $filename = $this->EpisodeFile()->getFilename(); - $filename = explode('.', $filename); + // return an empty string if there's no file + if(!$this->EpisodeFileID){ + return ''; + } $mime_types = array( 'mp3' => 'audio' @@ -145,7 +147,7 @@ public function getType() { ,'3gp' => 'video' ); - $extension = strtolower(end($filename)); + $extension = strtolower($this->EpisodeFile()->getExtension()); return $mime_types[$extension]; } diff --git a/code/pagetypes/PodcastPage.php b/code/pagetypes/PodcastPage.php index 9c2aa3a..d5b1db1 100644 --- a/code/pagetypes/PodcastPage.php +++ b/code/pagetypes/PodcastPage.php @@ -221,7 +221,7 @@ public function podcastEpisodes() { */ public function paginatedPodcastEpisodes() { $paginatedList = new PaginatedList( - podcastEpisodes() + $this->podcastEpisodes() ->filter(array('BlockEpisode' => '0')) ->sort('EpisodeDate', 'DESC') , $this->request