Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

build: modernize with "go fix -stringscutprefix": use strings.CutPrefix

Nick Craig-Woodaed06f9052f0
diff --git a/backend/iclouddrive/icloudphotos.go b/backend/iclouddrive/icloudphotos.go
index dd26ba9ee..697784395 100644
--- a/backend/iclouddrive/icloudphotos.go
+++ b/backend/iclouddrive/icloudphotos.go
@@ -376,8 +376,7 @@ func (f *PhotosFs) FindLeaf(ctx context.Context, pathID, leaf string) (pathIDOut
return "", false, nil
}
- if strings.HasPrefix(pathID, "lib:") {
- libraryName := strings.TrimPrefix(pathID, "lib:")
+ if libraryName, ok := strings.CutPrefix(pathID, "lib:"); ok {
libraries, err := photosService.GetLibraries(ctx)
if err != nil {
return "", false, err