Skip to content

Commit

Permalink
changed from direct download response to a 302 redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
Byorun committed Jul 12, 2018
1 parent e1d24fc commit 1b68a81
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/SongComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public function vote(string $key, User $user, int $direction): bool
/**
* @param $key
*
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
* @return \Illuminate\Http\RedirectResponse
*/
public function serveFileDownload($key)
{
Expand All @@ -327,7 +327,7 @@ public function serveFileDownload($key)
// @todo stop/prevent download count faking
if ($downloadCount = SongDetail::where('id', $split['detailId'])->where('song_id', $split['songId'])->increment('download_count', 1)) {
Cache::tags(['song-' . $split['songId']])->increment("downloads-{$split['detailId']}", 1);
return \response()->download(storage_path("app/public/songs") . "/{$split['songId']}/{$split['songId']}-{$split['detailId']}.zip");
return \response()->redirectTo(asset("storage/songs/{$split['songId']}/{$split['songId']}-{$split['detailId']}.zip"));
}

return abort(404);
Expand Down

0 comments on commit 1b68a81

Please sign in to comment.