@@ -2,7 +2,6 @@ package baiduphoto
2
2
3
3
import (
4
4
"context"
5
- "errors"
6
5
"fmt"
7
6
"net/http"
8
7
@@ -22,10 +21,6 @@ const (
22
21
FILE_API_URL_V2 = API_URL + "/file/v2"
23
22
)
24
23
25
- var (
26
- ErrNotSupportName = errors .New ("only chinese and english, numbers and underscores are supported, and the length is no more than 50" )
27
- )
28
-
29
24
func (d * BaiduPhoto ) Request (furl string , method string , callback base.ReqCallback , resp interface {}) ([]byte , error ) {
30
25
req := base .RestyClient .R ().
31
26
SetQueryParam ("access_token" , d .AccessToken )
@@ -48,6 +43,8 @@ func (d *BaiduPhoto) Request(furl string, method string, callback base.ReqCallba
48
43
return nil , fmt .Errorf ("you have joined album" )
49
44
case 50820 :
50
45
return nil , fmt .Errorf ("no shared albums found" )
46
+ case 50100 :
47
+ return nil , fmt .Errorf ("illegal title, only supports 50 characters" )
51
48
case - 6 :
52
49
if err = d .refreshToken (); err != nil {
53
50
return nil , err
@@ -188,9 +185,6 @@ func (d *BaiduPhoto) GetAllAlbumFile(ctx context.Context, album *Album, passwd s
188
185
189
186
// 创建相册
190
187
func (d * BaiduPhoto ) CreateAlbum (ctx context.Context , name string ) (* Album , error ) {
191
- if ! checkName (name ) {
192
- return nil , ErrNotSupportName
193
- }
194
188
var resp JoinOrCreateAlbumResp
195
189
_ , err := d .Post (ALBUM_API_URL + "/create" , func (r * resty.Request ) {
196
190
r .SetContext (ctx ).SetResult (& resp )
@@ -208,10 +202,6 @@ func (d *BaiduPhoto) CreateAlbum(ctx context.Context, name string) (*Album, erro
208
202
209
203
// 相册改名
210
204
func (d * BaiduPhoto ) SetAlbumName (ctx context.Context , album * Album , name string ) (* Album , error ) {
211
- if ! checkName (name ) {
212
- return nil , ErrNotSupportName
213
- }
214
-
215
205
_ , err := d .Post (ALBUM_API_URL + "/settitle" , func (r * resty.Request ) {
216
206
r .SetContext (ctx )
217
207
r .SetFormData (map [string ]string {
0 commit comments