Skip to content

Commit

Permalink
Merge pull request #4 from bummzack/fix-podcast-episodes-bugs
Browse files Browse the repository at this point in the history
Fixing two bugs.
  • Loading branch information
lukereative committed Apr 7, 2016
2 parents 6e46cb8 + 05ceb72 commit 27ff6d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions code/dataobjects/PodcastEpisode.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -145,7 +147,7 @@ public function getType() {
,'3gp' => 'video'
);

$extension = strtolower(end($filename));
$extension = strtolower($this->EpisodeFile()->getExtension());

return $mime_types[$extension];
}
Expand Down
2 changes: 1 addition & 1 deletion code/pagetypes/PodcastPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public function podcastEpisodes() {
*/
public function paginatedPodcastEpisodes() {
$paginatedList = new PaginatedList(
podcastEpisodes()
$this->podcastEpisodes()
->filter(array('BlockEpisode' => '0'))
->sort('EpisodeDate', 'DESC')
, $this->request
Expand Down

0 comments on commit 27ff6d3

Please sign in to comment.