π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Continue export during decryption failure
Neeraj Guptade19f450a8f1
diff --git a/cmd/export.go b/cmd/export.goindex fb850c2813..57548c4fe5 100644--- a/cmd/export.go+++ b/cmd/export.go@@ -10,7 +10,7 @@ var exportCmd = &cobra.Command{Short: "Starts the export process",Long: ``,Run: func(cmd *cobra.Command, args []string) {- ctrl.StartSync()+ ctrl.Export()},}diff --git a/main.go b/main.goindex 51a00d0cd2..168fb921df 100644--- a/main.go+++ b/main.go@@ -30,5 +30,4 @@ func main() {}}()cmd.Execute(&ctrl)- //ctrl.StartSync()}diff --git a/pkg/download.go b/pkg/download.goindex 05b991dccc..70a98a0189 100644--- a/pkg/download.go+++ b/pkg/download.go@@ -30,7 +30,8 @@ func (c *ClICtrl) downloadAndDecrypt(decryptedPath := fmt.Sprintf("%s/%d.decrypted", dir, file.ID)err = crypto.DecryptFile(downloadPath, decryptedPath, file.Key.MustDecrypt(deviceKey), encoding.DecodeBase64(file.FileNonce))if err != nil {- return nil, fmt.Errorf("error decrypting file %d: %w", file.ID, err)+ log.Printf("Error decrypting file %d: %s", file.ID, err)+ return nil, model.ErrDecryption}return &decryptedPath, nil}diff --git a/pkg/model/errors.go b/pkg/model/errors.gonew file mode 100644index 0000000000..7f041ef6e4--- /dev/null+++ b/pkg/model/errors.go@@ -0,0 +1,5 @@+package model++import "errors"++var ErrDecryption = errors.New("error while decrypting the file")diff --git a/pkg/remote_to_disk_file.go b/pkg/remote_to_disk_file.goindex 16ade9fd98..3dbe27bf74 100644--- a/pkg/remote_to_disk_file.go+++ b/pkg/remote_to_disk_file.go@@ -7,6 +7,7 @@ import ("cli-go/utils""context""encoding/json"+ "errors""fmt""log""os"@@ -67,7 +68,11 @@ func (c *ClICtrl) syncFiles(ctx context.Context, account model.Account) error {log.Printf("[%d/%d] Sync %s for album %s", i, len(entries), existingEntry.GetTitle(), albumInfo.AlbumName)err = c.downloadEntry(ctx, albumDiskInfo, *existingEntry, entry)if err != nil {- return err+ if errors.Is(err, model.ErrDecryption) {+ continue+ } else {+ return err+ }}} else {log.Fatalf("remoteFile %d not found in remoteFiles", entry.FileID)diff --git a/pkg/sync.go b/pkg/sync.goindex 504ffbd3d3..f0b822d14e 100644--- a/pkg/sync.go+++ b/pkg/sync.go@@ -11,13 +11,13 @@ import (bolt "go.etcd.io/bbolt")-func (c *ClICtrl) StartSync() error {+func (c *ClICtrl) Export() error {accounts, err := c.GetAccounts(context.Background())if err != nil {return err}if len(accounts) == 0 {- fmt.Printf("No accounts to sync\n")+ fmt.Printf("No accounts to sync\n Add account using `account add` cmd\n")return nil}for _, account := range accounts {