Skip to content

Commit

Permalink
Fix issue loading file from cloud disk (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
milewski committed Oct 12, 2023
1 parent e5026f0 commit e1b8620
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/Http/Controllers/LoadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,16 @@
namespace DigitalCreative\Filepond\Http\Controllers;

use DigitalCreative\Filepond\Data\Data;
use Illuminate\Support\Facades\Storage;
use Laravel\Nova\Http\Requests\NovaRequest;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\StreamedResponse;

class LoadController
{
public function __invoke(NovaRequest $request): BinaryFileResponse
public function __invoke(NovaRequest $request): StreamedResponse
{
$data = Data::fromEncrypted($request->input('serverId'));

return response()->file(
file: $data->absolutePath(),
headers: [
'Content-Disposition' => sprintf('inline; filename="%s"', basename($data->filename)),
],
);
return Storage::disk($data->disk)->response($data->path);
}
}

0 comments on commit e1b8620

Please sign in to comment.