Skip to content

Commit

Permalink
Fixed StorageStore.put incorrectly using Uint8Array.toString()
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre committed Feb 27, 2024
1 parent bbe3d9a commit 99e92c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/backends/Storage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SyncKeyValueStore, SimpleSyncStore, SyncKeyValueFileSystem, SimpleSyncRWTransaction, SyncKeyValueRWTransaction } from '@browserfs/core/backends/SyncStore.js';
import { ApiError, ErrorCode } from '@browserfs/core/ApiError.js';
import { CreateBackend, type BackendOptions } from '@browserfs/core/backends/backend.js';
import { encode } from '@browserfs/core/utils.js';
import { decode, encode } from '@browserfs/core/utils.js';

/**
* A synchronous key-value store backed by Storage.
Expand Down Expand Up @@ -37,7 +37,7 @@ export class StorageStore implements SyncKeyValueStore, SimpleSyncStore {
// Don't want to overwrite the key!
return false;
}
this._storage.setItem(key, data.toString());
this._storage.setItem(key, decode(data));
return true;
} catch (e) {
throw new ApiError(ErrorCode.ENOSPC, 'Storage is full.');
Expand Down

0 comments on commit 99e92c7

Please sign in to comment.