mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:41:44 +08:00
linkbox: fix working with names longer than 8-25 Unicode chars.
The LinkBox API does not allow searching by more than 25 Unicode characters in the name, for this reason it is currently impossible to work with files and folders named longer than 8 Unicode chars (if encoded in base32). This fix queries all files in a directory for long names and checks their names one by one, thus solving the issue. Fixes #7542
This commit is contained in:
parent
070cff8a65
commit
4258ad705e
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user