Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Simplify Live Photo export handling

Neeraj Guptae2c45ced3c4a
diff --git a/cli/pkg/remote_to_disk_file.go b/cli/pkg/remote_to_disk_file.go
index e1dba37c6e..7e0bc959d7 100644
--- a/cli/pkg/remote_to_disk_file.go
+++ b/cli/pkg/remote_to_disk_file.go
@@ -153,29 +153,13 @@ func (c *ClICtrl) downloadEntry(ctx context.Context,
}
defer os.Remove(imagePath)
defer os.Remove(videoPath)
- if imagePath == "" && videoPath == "" {
- log.Printf("imagePath %s, videoPath %s", imagePath, videoPath)
- return model.ErrLiveZip
- }
- if imagePath != "" {
- imageExtn := filepath.Ext(imagePath)
- imageFileName := diskInfo.GenerateUniqueFileName(baseFileName, imageExtn)
- imageFilePath := filepath.Join(diskInfo.ExportRoot, diskInfo.AlbumMeta.FolderName, imageFileName)
- moveErr := Move(imagePath, imageFilePath)
- if moveErr != nil {
- return moveErr
- }
- fileDiskMetadata.AddFileName(imageFileName)
- }
- if videoPath != "" {
- videoExtn := filepath.Ext(videoPath)
- videoFileName := diskInfo.GenerateUniqueFileName(baseFileName, videoExtn)
- videoFilePath := filepath.Join(diskInfo.ExportRoot, diskInfo.AlbumMeta.FolderName, videoFileName)
- moveErr := Move(videoPath, videoFilePath)
- if moveErr != nil {
- return moveErr
+ for _, componentPath := range []string{imagePath, videoPath} {
+ fileName := diskInfo.GenerateUniqueFileName(baseFileName, filepath.Ext(componentPath))
+ filePath := filepath.Join(diskInfo.ExportRoot, diskInfo.AlbumMeta.FolderName, fileName)
+ if err := Move(componentPath, filePath); err != nil {
+ return err
}
- fileDiskMetadata.AddFileName(videoFileName)
+ fileDiskMetadata.AddFileName(fileName)
}
} else {
fileName := diskInfo.GenerateUniqueFileName(baseFileName, extension)