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

linkbox: fix working with names longer than 8-25 Unicode chars.

Vitaly4258ad705e34
diff --git a/backend/linkbox/linkbox.go b/backend/linkbox/linkbox.go
index 75445ea72..fd70c2cd5 100644
--- a/backend/linkbox/linkbox.go
+++ b/backend/linkbox/linkbox.go
@@ -219,7 +219,8 @@ type listAllFn func(*entity) bool
// Search is a bit fussy about which characters match
//
// If the name doesn't match this then do an dir list instead
-var searchOK = regexp.MustCompile(`^[a-zA-Z0-9_ .]+$`)
+// N.B.: Linkbox doesn't support search by name that is longer than 50 chars
+var searchOK = regexp.MustCompile(`^[a-zA-Z0-9_ .]{1,50}$`)
// Lists the directory required calling the user function on each item found
//
@@ -238,6 +239,7 @@ func (f *Fs) listAll(ctx context.Context, dirID string, name string, fn listAllF
// If name isn't good then do an unbounded search
name = ""
}
+
OUTER:
for numberOfEntities == maxEntitiesPerPage {
pageNumber++
@@ -258,7 +260,6 @@ OUTER:
err = getUnmarshaledResponse(ctx, f, opts, &responseResult)
if err != nil {
return false, fmt.Errorf("getting files failed: %w", err)
-
}
numberOfEntities = len(responseResult.SearchData.Entities)
diff --git a/backend/linkbox/linkbox_test.go b/backend/linkbox/linkbox_test.go
index aa03c79ca..d9b448c0c 100644
--- a/backend/linkbox/linkbox_test.go
+++ b/backend/linkbox/linkbox_test.go
@@ -13,5 +13,7 @@ func TestIntegration(t *testing.T) {
fstests.Run(t, &fstests.Opt{
RemoteName: "TestLinkbox:",
NilObject: (*linkbox.Object)(nil),
+ // Linkbox doesn't support leading dots for files
+ SkipLeadingDot: true,
})
}
diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.go
index 58420991f..3e3237f1a 100644
--- a/fstest/fstests/fstests.go
+++ b/fstest/fstests/fstests.go
@@ -303,6 +303,7 @@ type Opt struct {
SkipObjectCheckWrap bool // if set skip ObjectCheckWrap
SkipDirectoryCheckWrap bool // if set skip DirectoryCheckWrap
SkipInvalidUTF8 bool // if set skip invalid UTF-8 checks
+ SkipLeadingDot bool // if set skip leading dot checks
QuickTestOK bool // if set, run this test with make quicktest
}
@@ -690,6 +691,9 @@ func Run(t *testing.T, opt *Opt) {
if opt.SkipInvalidUTF8 && test.name == "invalid UTF-8" {
t.Skip("Skipping " + test.name)
}
+ if opt.SkipLeadingDot && test.name == "leading dot" {
+ t.Skip("Skipping " + test.name)
+ }
// turn raw strings into Standard encoding
fileName := encoder.Standard.Encode(test.path)
dirName := fileName