Skip to content
This repository has been archived by the owner on May 7, 2019. It is now read-only.

Commit

Permalink
[fix] Prevent an edge case with view caching involving two users havi…
Browse files Browse the repository at this point in the history
…ng the same file hash
  • Loading branch information
TheReverend403 committed Jul 5, 2016
1 parent 4e3a50d commit 63d0a0d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/Http/Controllers/DownloadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function get(Request $request, Upload $upload)
}

if (!$request->user() || $request->user()->id !== $upload->user_id) {
$cacheKey = sprintf('cached_view:%s:%s', $request->ip(), $upload->hash);
$cacheKey = sprintf('cached_view:%s:%s', $request->ip(), $upload->name);
if (!Cache::has($cacheKey)) {
Cache::put($cacheKey, 1, 60);
DB::table('uploads')->where('id', $upload->id)->increment('views');
Expand Down

0 comments on commit 63d0a0d

Please sign in to comment.