iclouddrive: fix "Index has invalid data" error listing iCloud Photos

Accounts with shared-album zones (named CMM-*) returned these zones in
the photos changes/database listing alongside the real photo
libraries. rclone treated them as libraries and queried their albums,
but these zones have no CPLAlbumByPositionLive index so the query
failed with BAD_REQUEST / "Index has invalid data", aborting the whole
listing.

Only PrimarySync and SharedSync-* zones are photo libraries, so skip
any other zone during discovery.

See: https://forum.rclone.org/t/sync-to-icloud-gives-index-has-invalid-data-errors/53852
This commit is contained in:
Nick Craig-Wood
2026-05-31 09:39:59 +01:00
parent 8b981d8a69
commit ffd36fc2d7

View File

@@ -606,6 +606,13 @@ func (ps *PhotosService) discoverLibraries(ctx context.Context) (*libraryDiscove
continue
}
name := zone.ZoneID.ZoneName
// Only PrimarySync and SharedSync-* are photo libraries. Other
// zones (e.g. CMM-* shared-album zones) appear in changes/database
// but have no CPLAlbumByPositionLive index, so querying their
// albums returns BAD_REQUEST / "Index has invalid data".
if name != "PrimarySync" && !strings.HasPrefix(name, "SharedSync") {
continue
}
// SharedSync-* found in private takes precedence over shared
if _, exists := result.libraries[name]; exists {
continue