Browse Source

set version default value to zero

Abhinav-grd 4 years ago
parent
commit
cc5dc4aa43
2 changed files with 3 additions and 2 deletions
  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 encryptedPath;
   final String pathDecryptionNonce;
   final String pathDecryptionNonce;
   final int version;
   final int version;
+
   CollectionAttributes({
   CollectionAttributes({
     this.encryptedPath,
     this.encryptedPath,
     this.pathDecryptionNonce,
     this.pathDecryptionNonce,
-    this.version,
+    this.version = 0,
   });
   });
 
 
   CollectionAttributes copyWith({
   CollectionAttributes copyWith({

+ 1 - 1
lib/services/collections_service.dart

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