Skip to content

armgit / ente

Public Imported from GitHub
0

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

Sanitize album folder names during export

Neeraj Gupta6c5c1f02d928
diff --git a/cli/pkg/remote_to_disk_album.go b/cli/pkg/remote_to_disk_album.go
index f4f2667eb2..792a8a7cd9 100644
--- a/cli/pkg/remote_to_disk_album.go
+++ b/cli/pkg/remote_to_disk_album.go
@@ -49,9 +49,11 @@ func (c *ClICtrl) createLocalFolderForRemoteAlbums(ctx context.Context, account
}
albumFolderName := filepath.Clean(album.AlbumName)
- albumFolderName = strings.ReplaceAll(albumFolderName, ":", "_")
- albumFolderName = strings.ReplaceAll(albumFolderName, "/", "_")
+ albumFolderName = strings.NewReplacer(":", "_", "/", "_", "\\", "_").Replace(albumFolderName)
albumFolderName = strings.TrimSpace(albumFolderName)
+ if albumFolderName == "" || albumFolderName == "." || albumFolderName == ".." {
+ albumFolderName = "_"
+ }
albumID := album.ID