π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fix mapping for early collections
Neeraj Guptaa79c8b34ff18
diff --git a/pkg/mappers.go b/pkg/mappers.goindex 48846403fa..273c557f7a 100644--- a/pkg/mappers.go+++ b/pkg/mappers.go@@ -11,22 +11,28 @@ import (func (c *ClICtrl) mapCollectionToAlbum(ctx context.Context, collection api.Collection) (*model.Album, error) {var album model.AlbumuserID := ctx.Value("user_id").(int64)- collectionKey, err := c.KeyHolder.GetCollectionKey(ctx, collection)album.OwnerID = collection.Owner.IDalbum.ID = collection.IDalbum.IsShared = collection.Owner.ID != userID- album.AlbumKey = *model.MakeEncString(collectionKey, c.CliKey)album.LastUpdatedAt = collection.UpdationTimealbum.IsDeleted = collection.IsDeleted+ collectionKey, err := c.KeyHolder.GetCollectionKey(ctx, collection)if err != nil {return nil, err}- name, nameErr := enteCrypto.SecretBoxOpenBase64(collection.EncryptedName, collection.NameDecryptionNonce, collectionKey)- if nameErr != nil {- log.Fatalf("failed to decrypt collection name: %v", nameErr)+ album.AlbumKey = *model.MakeEncString(collectionKey, c.CliKey)+ var name string+ if collection.EncryptedName != "" {+ decrName, err := enteCrypto.SecretBoxOpenBase64(collection.EncryptedName, collection.NameDecryptionNonce, collectionKey)+ if err != nil {+ log.Fatalf("failed to decrypt collection name: %v", err)+ }+ name = string(decrName)+ } else {+ // Early beta users (friends & family) might have collections without encrypted names+ name = collection.Name}- album.AlbumName = string(name)-+ album.AlbumName = nameif collection.MagicMetadata != nil {_, encodedJsonBytes, err := enteCrypto.DecryptChaChaBase64(collection.MagicMetadata.Data, collectionKey, collection.MagicMetadata.Header)if err != nil {