Merge pull request #2114 from burakcakirel/delete-attachments

Delete attachment's file on disk
This commit is contained in:
Denis Duliçi 2021-06-18 13:29:35 +03:00 committed by GitHub
commit c45d7f596f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -27,11 +27,11 @@ class Uploads extends Controller
} }
// Get file path // Get file path
if (!$path = $this->getMediaPathOnStorage($media)) { if (!$this->getMediaPathOnStorage($media)) {
return response(null, 204); return response(null, 204);
} }
return $this->streamMedia($media, $path); return $this->streamMedia($media);
} }
/** /**
@ -70,7 +70,7 @@ class Uploads extends Controller
} }
// Get file path // Get file path
if (!$path = $this->getMediaPathOnStorage($media)) { if (!$this->getMediaPathOnStorage($media)) {
return response()->json([ return response()->json([
'success' => false, 'success' => false,
'error' => true, 'error' => true,
@ -108,11 +108,11 @@ class Uploads extends Controller
} }
// Get file path // Get file path
if (!$path = $this->getMediaPathOnStorage($media)) { if (!$this->getMediaPathOnStorage($media)) {
return false; return false;
} }
return $this->streamMedia($media, $path); return $this->streamMedia($media);
} }
/** /**

View File

@ -100,10 +100,10 @@ trait Uploads
return false; return false;
} }
return Storage::path($path); return $path;
} }
public function streamMedia($media, $path = '') public function streamMedia($media)
{ {
return response()->streamDownload( return response()->streamDownload(
function() use ($media) { function() use ($media) {