So I am using Wasabi for object storage in my Laravel API, but after I got the upload working, now I can't get the download to work.
I am using this package: https://github.com/ProbablyRational/wasabi-storage, instead of the flysystem-s3 package (although it uses it internally anyway).
This is how I upload my files (only the relevant part):
$fileName = uniqid(). '.' . File::extension($file->getClientOriginalName());
Storage::disk('s3')->put('/tracks/' . $fileName, $file->getContent());
$track = Track::create(array_merge($request->all(), ['file' => $fileName]));
return response()->json($track, 201);
This works and I can see the files in my Wasabi bucket.
But when trying to get the file:
$response = new BinaryFileResponse(
Storage::disk('s3')->get(json_encode('tracks/' . $track->file))
);
BinaryFileResponse::trustXSendfileTypeHeader();
$headers = 'Content-Type: audio/mpeg';
$response.header($headers);
This returns "File not found at path: "tracks/62751e3730359.wav"", even though the file is uploaded.