[Bug]: Blob data storage not working
nick-potts opened this issue · comments
What happened?
Blob storage doesn't work:
GuzzleHttp\Exception\InvalidArgumentException: json_encode error: Malformed UTF-8 characters, possibly incorrectly encoded
How to reproduce the bug
Schema::create('blob', function (\Illuminate\Database\Schema\Blueprint $table) {
$table->binary('blob');
});
$data = random_bytes(50);
$result = DB::table('blob')->insert([
'blob' => $data,
]);
$newData = DB::table('blob')->first();
expect($result)->toBeTrue()
->and(DB::table('blob')->count())->toBe(1)
->and($newData->blob)->toBe($data);
Package Version
0.6
PHP Version
8.3
Laravel Version
11.0
Which operating systems does with happen with?
macOS
Notes
No response
Potentially may have to mb_check_encoding($data, 'UTF-8');
and store it as blob if required.
I had a quick crack at it, but I'm getting a weird response from libsql.
here it should be using base64
, not value
as per the HNANA docs.
I don't really have time to do a full investigation (and I don't even use turso), but should help you get started.
Hi @nick-potts, thanks for submitting the issue. This is a good catch. I've never encountered this issue since I haven't saved blob data in any of my database tables. I've confirmed that the issue is valid, and I'm working on it now.
PS: Thanks for the pointers!
I'm closing this issue for now since a permanent fix isn't coming soon. I've already merged a pull request with a quick fix into the main branch (See #4).
You can follow the discussion about a permanent fix with the Turso development team here:
https://discord.com/channels/933071162680958986/1232184577179648092/1232184577179648092