Преглед изворни кода

Don't rely on cache that does not exist yet

Vishnu Mohandas пре 4 година
родитељ
комит
db47586424
2 измењених фајлова са 6 додато и 5 уклоњено
  1. 1 1
      lib/models/collection.dart
  2. 5 4
      lib/services/collections_service.dart

+ 1 - 1
lib/models/collection.dart

@@ -203,7 +203,7 @@ class CollectionAttributes {
     if (pathDecryptionNonce != null) {
     if (pathDecryptionNonce != null) {
       map['pathDecryptionNonce'] = pathDecryptionNonce;
       map['pathDecryptionNonce'] = pathDecryptionNonce;
     }
     }
-    if (version != null) map['version'] = version;
+    map['version'] = version ?? 0;
     return map;
     return map;
   }
   }
 
 

+ 5 - 4
lib/services/collections_service.dart

@@ -260,9 +260,10 @@ class CollectionsService {
       Sodium.bin2base64(encryptedPath.nonce),
       Sodium.bin2base64(encryptedPath.nonce),
       CollectionType.folder,
       CollectionType.folder,
       CollectionAttributes(
       CollectionAttributes(
-          encryptedPath: Sodium.bin2base64(encryptedPath.encryptedData),
-          pathDecryptionNonce: Sodium.bin2base64(encryptedPath.nonce),
-          version: 1),
+        encryptedPath: Sodium.bin2base64(encryptedPath.encryptedData),
+        pathDecryptionNonce: Sodium.bin2base64(encryptedPath.nonce),
+        version: 1,
+      ),
       null,
       null,
       null,
       null,
     ));
     ));
@@ -347,7 +348,7 @@ class CollectionsService {
 
 
   String decryptCollectionPath(Collection collection) {
   String decryptCollectionPath(Collection collection) {
     final key = collection.attributes.version == 1
     final key = collection.attributes.version == 1
-        ? getCollectionKey(collection.id)
+        ? _getDecryptedKey(collection)
         : _config.getKey();
         : _config.getKey();
     return utf8.decode(CryptoUtil.decryptSync(
     return utf8.decode(CryptoUtil.decryptSync(
         Sodium.base642bin(collection.attributes.encryptedPath),
         Sodium.base642bin(collection.attributes.encryptedPath),