Skip to content

Commit

Permalink
检查文件是否存在
Browse files Browse the repository at this point in the history
  • Loading branch information
mradang committed Jan 6, 2021
1 parent a89bc02 commit 7b06001
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Services/AttachmentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ public static function showImage($class, $key, int $id, int $width, int $height)
abort('500', 'Not a picture.');
}

if (!Storage::disk(config('attachment.disk'))->exists($attachment->filename)) {
abort(404);
}

if (!$width || !$height) {
return Storage::disk(config('attachment.disk'))->download($attachment->filename);
}
Expand Down

0 comments on commit 7b06001

Please sign in to comment.