Repository: AlistGo/alist (language: go)

Issue:
一刻相册的相册名称长度或者是合规性判定不准确
### Please make sure of the following things

- [X] I have read the [documentation](https://alist.nn.ci).
- [X] I'm sure there are no duplicate issues or discussions.
- [X] I'm sure it's due to `alist` and not something else(such as `Dependencies` or `Operational`).
- [X] I'm sure I'm using the latest version

### Alist Version / Alist 版本

v3.17.0

### Driver used / 使用的存储驱动

一刻相册

### Describe the bug / 问题描述

当我通过alist在一刻相册上创建相册名为：“3_写真_秀人网XiuRen_1575_奶瓶土肥圆矮挫丑黑穷”，按照一刻相册官方计算长度为45个字符，规则应该是按照中文算两个字符，英文数字符号算一个这么计算的

通过一刻相册官方网页端创建成功，名称符合要求：
![image](https://github.com/alist-org/alist/assets/104119487/4a0eec1c-7734-4aa9-9b2b-ca8580d6f727)
![image](https://github.com/alist-org/alist/assets/104119487/30516c18-a1f5-4c13-9446-900b7232e57b)

通过dav挂载alist创建不成功，log提示：
![image](https://github.com/alist-org/alist/assets/104119487/f05e66f2-72f2-450c-ab16-bab824605f51)
通过alist网页端创建相册，提示错误：
![msedge_Y25j6QYrY5](https://github.com/alist-org/alist/assets/104119487/f4f4363c-b788-441c-ab5b-efe0759e86eb)



### Reproduction / 复现链接

https://photo.baidu.com/photo/web/album

### Logs / 日志

### 这段是通过webdav挂载alist创建相册失败的log：
ERRO[2023-05-26 16:28:26] MKCOL /dav/一刻相册/3_写真_秀人网XiuRen_1575_奶瓶土肥圆矮挫丑黑穷 only chinese and english, numbers and underscores are supported, and the length is no more than 50
github.com/alist-org/alist/v3/internal/op.MakeDir.func1
	/source/internal/op/fs.go:324
github.com/alist-org/alist/v3/pkg/singleflight.(*Group[...]).doCall.func2
	/source/pkg/singleflight/singleflight.go:193
github.com/alist-org/alist/v3/pkg/singleflight.(*Group[...]).doCall
	/source/pkg/singleflight/singleflight.go:195
github.com/alist-org/alist/v3/pkg/singleflight.(*Group[...]).Do
	/source/pkg/singleflight/singleflight.go:108
github.com/alist-org/alist/v3/internal/op.MakeDir
	/source/internal/op/fs.go:289
github.com/alist-org/alist/v3/internal/fs.makeDir
	/source/internal/fs/other.go:17
github.com/alist-org/alist/v3/internal/fs.MakeDir
	/source/internal/fs/fs.go:57
github.com/alist-org/alist/v3/server/webdav.(*Handler).handleMkcol
	/source/server/webdav/webdav.go:369
github.com/alist-org/alist/v3/server/webdav.(*Handler).ServeHTTP
	/source/server/webdav/webdav.go:65
github.com/alist-org/alist/v3/server.ServeWebDAV
	/source/server/webdav.go:43
github.com/gin-gonic/gin.(*Context).Next
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174
github.com/alist-org/alist/v3/server.WebDAVAuth
	/source/server/webdav.go:92
github.com/gin-gonic/gin.(*Context).Next
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174
github.com/alist-org/alist/v3/server/middlewares.StoragesLoaded
	/source/server/middlewares/check.go:14
github.com/gin-gonic/gin.(*Context).Next
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174
github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/recovery.go:102
github.com/gin-gonic/gin.(*Context).Next
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174
github.com/gin-gonic/gin.LoggerWithConfig.func1
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/logger.go:240
github.com/gin-gonic/gin.(*Context).Next
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:620
github.com/gin-gonic/gin.(*Engine).ServeHTTP
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:576
net/http.serverHandler.ServeHTTP
	/usr/local/go/src/net/http/server.go:2936
net/http.(*conn).serve
	/usr/local/go/src/net/http/server.go:1995
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1598 
[GIN] 2023/05/26 - 16:28:26 | 405 |      1.2521ms |       127.0.0.1 | MKCOL    "/dav/一刻相册/3_写真_秀人网XiuRen_1575_奶瓶土肥圆矮挫丑黑穷"

### 这段是通过alist的web端创建失败的log：
ERRO[2023-05-26 16:50:07] failed make dir /一刻相册/3_写真_秀人网XiuRen_1301_奶瓶土肥圆矮挫丑黑穷: only chinese and english, numbers and underscores are supported, and the length is no more than 50
github.com/alist-org/alist/v3/internal/op.MakeDir.func1
	/source/internal/op/fs.go:324
github.com/alist-org/alist/v3/pkg/singleflight.(*Group[...]).doCall.func2
	/source/pkg/singleflight/singleflight.go:193
github.com/alist-org/alist/v3/pkg/singleflight.(*Group[...]).doCall
	/source/pkg/singleflight/singleflight.go:195
github.com/alist-org/alist/v3/pkg/singleflight.(*Group[...]).Do
	/source/pkg/singleflight/singleflight.go:108
github.com/alist-org/alist/v3/internal/op.MakeDir
	/source/internal/op/fs.go:289
github.com/alist-org/alist/v3/internal/fs.makeDir
	/source/internal/fs/other.go:17
github.com/alist-org/alist/v3/internal/fs.MakeDir
	/source/internal/fs/fs.go:57
github.com/alist-org/alist/v3/server/handles.FsMkdir
	/source/server/handles/fsmanage.go:51
github.com/gin-gonic/gin.(*Context).Next
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174
github.com/alist-org/alist/v3/server/middlewares.Auth
	/source/server/middlewares/auth.go:67
github.com/gin-gonic/gin.(*Context).Next
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174
github.com/alist-org/alist/v3/server/middlewares.StoragesLoaded
	/source/server/middlewares/check.go:14
github.com/gin-gonic/gin.(*Context).Next
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174
github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/recovery.go:102
github.com/gin-gonic/gin.(*Context).Next
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174
github.com/gin-gonic/gin.LoggerWithConfig.func1
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/logger.go:240
github.com/gin-gonic/gin.(*Context).Next
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:620
github.com/gin-gonic/gin.(*Engine).ServeHTTP
	/go/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:576
net/http.serverHandler.ServeHTTP
	/usr/local/go/src/net/http/server.go:2936
net/http.(*conn).serve
	/usr/local/go/src/net/http/server.go:1995
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1598 
[GIN] 2023/05/26 - 16:50:07 | 200 |       886.9µs |       127.0.0.1 | POST     "/api/fs/mkdir"


Discussion / hints:

Fix patch:
diff --git a/drivers/baidu_photo/help.go b/drivers/baidu_photo/help.go
index bf234534c90..e9b9331b7e0 100644
--- a/drivers/baidu_photo/help.go
+++ b/drivers/baidu_photo/help.go
@@ -4,7 +4,6 @@ import (
 	"fmt"
 	"math"
 	"math/rand"
-	"regexp"
 	"strings"
 	"time"
 
@@ -16,11 +15,6 @@ func getTid() string {
 	return fmt.Sprintf("3%d%.0f", time.Now().Unix(), math.Floor(9000000*rand.Float64()+1000000))
 }
 
-// 检查名称
-func checkName(name string) bool {
-	return len(name) <= 50 && regexp.MustCompile("[\u4e00-\u9fa5A-Za-z0-9_-]").MatchString(name)
-}
-
 func toTime(t int64) *time.Time {
 	tm := time.Unix(t, 0)
 	return &tm
diff --git a/drivers/baidu_photo/utils.go b/drivers/baidu_photo/utils.go
index 15761036c65..9715bdbfdf6 100644
--- a/drivers/baidu_photo/utils.go
+++ b/drivers/baidu_photo/utils.go
@@ -2,7 +2,6 @@ package baiduphoto
 
 import (
 	"context"
-	"errors"
 	"fmt"
 	"net/http"
 
@@ -22,10 +21,6 @@ const (
 	FILE_API_URL_V2 = API_URL + "/file/v2"
 )
 
-var (
-	ErrNotSupportName = errors.New("only chinese and english, numbers and underscores are supported, and the length is no more than 50")
-)
-
 func (d *BaiduPhoto) Request(furl string, method string, callback base.ReqCallback, resp interface{}) ([]byte, error) {
 	req := base.RestyClient.R().
 		SetQueryParam("access_token", d.AccessToken)
@@ -48,6 +43,8 @@ func (d *BaiduPhoto) Request(furl string, method string, callback base.ReqCallba
 		return nil, fmt.Errorf("you have joined album")
 	case 50820:
 		return nil, fmt.Errorf("no shared albums found")
+	case 50100:
+		return nil, fmt.Errorf("illegal title, only supports 50 characters")
 	case -6:
 		if err = d.refreshToken(); err != nil {
 			return nil, err
@@ -188,9 +185,6 @@ func (d *BaiduPhoto) GetAllAlbumFile(ctx context.Context, album *Album, passwd s
 
 // 创建相册
 func (d *BaiduPhoto) CreateAlbum(ctx context.Context, name string) (*Album, error) {
-	if !checkName(name) {
-		return nil, ErrNotSupportName
-	}
 	var resp JoinOrCreateAlbumResp
 	_, err := d.Post(ALBUM_API_URL+"/create", func(r *resty.Request) {
 		r.SetContext(ctx).SetResult(&resp)
@@ -208,10 +202,6 @@ func (d *BaiduPhoto) CreateAlbum(ctx context.Context, name string) (*Album, erro
 
 // 相册改名
 func (d *BaiduPhoto) SetAlbumName(ctx context.Context, album *Album, name string) (*Album, error) {
-	if !checkName(name) {
-		return nil, ErrNotSupportName
-	}
-
 	_, err := d.Post(ALBUM_API_URL+"/settitle", func(r *resty.Request) {
 		r.SetContext(ctx)
 		r.SetFormData(map[string]string{


Test patch: