Commit cb8db1a0 authored by Krille's avatar Krille
Browse files

fix: Created path using collection names

parent e799aae7
......@@ -37,7 +37,7 @@ class BackendManager implements BackendManagerInterface {
if (path.endsWith(_delimiter)) path = path.substring(0, path.length - 1);
if (collection != null) {
path = path + collection;
path = '$path/$collection';
}
var dir = Directory(path);
......
......@@ -33,6 +33,9 @@ class BoxCollection implements implementation.BoxCollection {
HiveCipher? cipher,
bool useLocks = true,
}) async {
if (name.contains('/') || name.trim() != name || name.isEmpty) {
throw HiveError('Invalid collection name "$name"');
}
// compatibility for [key]
cipher ??= key;
......@@ -140,7 +143,7 @@ class CollectionBox<V> implements implementation.CollectionBox<V> {
if (_cachedBox == null || !_cachedBox!.isOpen) {
final hive = Hive as HiveImpl;
_cachedBox = hive.isBoxOpen(name, boxCollection.name)
? hive.lazyBox(name, boxCollection.name)
? hive.lazyBox(name, boxCollection.name)
: await hive.openLazyBox(
name,
encryptionCipher: boxCollection._cipher,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment