drive: handle shared drives with leading/trailing space in name (related to #6618)

This commit is contained in:
albertony
2022-12-12 20:05:12 +01:00
parent 8b9f3bbe29
commit 5a59b49b6b
3 changed files with 51 additions and 30 deletions

View File

@@ -18,7 +18,6 @@ import (
"net/http"
"os"
"path"
"regexp"
"sort"
"strconv"
"strings"
@@ -3431,13 +3430,12 @@ func (f *Fs) Command(ctx context.Context, name string, arg []string, opt map[str
if err != nil {
return nil, err
}
re := regexp.MustCompile(`[^\w\p{L}\p{N}. -]+`)
if _, ok := opt["config"]; ok {
lines := []string{}
upstreams := []string{}
names := make(map[string]struct{}, len(drives))
for i, drive := range drives {
name := re.ReplaceAllString(drive.Name, "_")
name := fspath.MakeConfigName(drive.Name)
for {
if _, found := names[name]; !found {
break