瀏覽代碼

set version default value to zero

Abhinav-grd 4 年之前
父節點
當前提交
cc5dc4aa43
共有 2 個文件被更改,包括 3 次插入2 次删除
  1. 2 1
      lib/models/collection.dart
  2. 1 1
      lib/services/collections_service.dart

+ 2 - 1
lib/models/collection.dart

@@ -176,10 +176,11 @@ class CollectionAttributes {
   final String encryptedPath;
   final String pathDecryptionNonce;
   final int version;
+
   CollectionAttributes({
     this.encryptedPath,
     this.pathDecryptionNonce,
-    this.version,
+    this.version = 0,
   });
 
   CollectionAttributes copyWith({

+ 1 - 1
lib/services/collections_service.dart

@@ -324,7 +324,7 @@ class CollectionsService {
   }
 
   String decryptCollectionPath(Collection collection) {
-    final key = collection.attributes.version != null
+    final key = collection.attributes.version == 0
         ? getCollectionKey(collection.id)
         : _config.getKey();
     return utf8.decode(CryptoUtil.decryptSync(