Fixes #18: Fix downloading of private playlists for playlist owners

This commit is contained in:
Kelvin Zhang 2015-11-07 17:54:58 +00:00
parent 967b45c7a7
commit dc117351ce

View file

@ -63,8 +63,12 @@ class PlaylistsController extends Controller
public function getDownload($id, $extension)
{
$playlist = Playlist::with('tracks', 'user', 'tracks.album')->find($id);
if (!$playlist || !$playlist->is_public) {
if (!$playlist || (!$playlist->is_public && !Auth::check())) {
App::abort(404);
} elseif (!$playlist->is_public && Auth::check()) {
if ($playlist->user_id !== Auth::user()->id) {
App::abort(404);
}
}
$format = null;