"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
refactor: use slices.Contains to simplify code
caltechustcbe3bfe2d19a3
diff --git a/backend/huaweidrive/huaweidrive.go b/backend/huaweidrive/huaweidrive.goindex 424637b3e..c1721130a 100644--- a/backend/huaweidrive/huaweidrive.go+++ b/backend/huaweidrive/huaweidrive.go@@ -15,6 +15,7 @@ import ("net/url""os""path"+ "slices""strconv""strings""sync"@@ -1166,14 +1167,7 @@ func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object,fs.Debugf(f, "Cross-directory move returned no parentFolder. Falling back to copy+delete.")return nil, fs.ErrorCantMove}- parentFound := false- for _, actualParent := range info.ParentFolder {- if actualParent == dstDirectoryID {- parentFound = true- break- }- }- if !parentFound {+ if !slices.Contains(info.ParentFolder, dstDirectoryID) {fs.Debugf(f, "Cross-directory move failed: expected parent=%q, got=%v. Falling back to copy+delete.",dstDirectoryID, info.ParentFolder)return nil, fs.ErrorCantMovediff --git a/backend/huaweidrive/huaweidrive_test.go b/backend/huaweidrive/huaweidrive_test.goindex a5285f2ab..e5c72615f 100644--- a/backend/huaweidrive/huaweidrive_test.go+++ b/backend/huaweidrive/huaweidrive_test.go@@ -7,6 +7,7 @@ import ("mime""net/http""path"+ "slices""testing""time"@@ -433,15 +434,7 @@ func TestMimeTypeDetection(t *testing.T) {}// Check if detected MIME type is in the list of expected types- found := false- for _, expected := range tc.expectedMimes {- if detected == expected {- found = true- break- }- }-- if !found {+ if !slices.Contains(tc.expectedMimes, detected) {t.Errorf("expected one of MIME types %v for %q, got %q", tc.expectedMimes, tc.filename, detected)}})diff --git a/backend/iclouddrive/api/photos.go b/backend/iclouddrive/api/photos.goindex 06cdc226e..c014b50ce 100644--- a/backend/iclouddrive/api/photos.go+++ b/backend/iclouddrive/api/photos.go@@ -12,6 +12,7 @@ import ("os""path""path/filepath"+ "slices""strings""sync""sync/atomic"@@ -1417,11 +1418,8 @@ func (lib *Library) applyPendingDelta(ctx context.Context) bool {// Route new photos to smart albums based on classifySmartAlbums()if isSmart {for _, p := range addedPhotos {- for _, sa := range p.SmartAlbums {- if sa == album.Name {- filtered = append(filtered, p)- break- }+ if slices.Contains(p.SmartAlbums, album.Name) {+ filtered = append(filtered, p)}}}