{"record":{"id":"4e11a2b5230ec796","repo":"AlistGo/alist","slug":"illegal-title-only-supports-50-characters","errorCode":null,"errorMessage":"illegal title, only supports 50 characters","messagePattern":"illegal title, only supports 50 characters","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/baidu_photo/utils.go","lineNumber":50,"sourceCode":"\t}\n\tif resp != nil {\n\t\treq.SetResult(resp)\n\t}\n\tres, err := req.Execute(method, furl)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terron := utils.Json.Get(res.Body(), \"errno\").ToInt()\n\tswitch erron {\n\tcase 0:\n\t\tbreak\n\tcase 50805:\n\t\treturn nil, fmt.Errorf(\"you have joined album\")\n\tcase 50820:\n\t\treturn nil, fmt.Errorf(\"no shared albums found\")\n\tcase 50100:\n\t\treturn nil, fmt.Errorf(\"illegal title, only supports 50 characters\")\n\t// case -6:\n\t// \tif err = d.refreshToken(); err != nil {\n\t// \t\treturn nil, err\n\t// \t}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"errno: %d, refer to https://photo.baidu.com/union/doc\", erron)\n\t}\n\treturn res, nil\n}\n\n//func (d *BaiduPhoto) Request(furl string, method string, callback base.ReqCallback, resp interface{}) ([]byte, error) {\n//\tres, err := d.request(furl, method, callback, resp)\n//\tif err != nil {\n//\t\treturn nil, err\n//\t}\n//\treturn res.Body(), nil\n//}\n","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/baidu_photo/utils.go#L32-L68","documentation":"The Baidu Photo union API returned errno 50100, mapped in Request (drivers/baidu_photo/utils.go:50) to 'illegal title, only supports 50 characters'. Album names (create via CreateAlbum, rename via SetAlbumName, both reachable from MakeDir/Rename in driver.go) are validated server-side: the title must be at most 50 characters and use characters Baidu accepts.","triggerScenarios":"Creating an album whose name exceeds 50 characters; renaming an album to a long name; album names containing emoji or characters outside the accepted set.","commonSituations":"Mapping arbitrary folder names from another storage backend onto Baidu Photo albums; long auto-generated names from sync jobs; user pasting a long string into the album name field.","solutions":["Validate/truncate the album title to <= 50 characters before CreateAlbum/SetAlbumName","Strip emoji and unusual unicode from names before sending","Surface a clear form-level error in the UI instead of the raw driver error"],"exampleFix":"// before\nalbum, err := d.CreateAlbum(ctx, dirName) // dirName may be 200 chars\n\n// after\nname := []rune(dirName)\nif len(name) > 50 {\n    name = name[:50]\n}\nalbum, err := d.CreateAlbum(ctx, string(name))","handlingStrategy":"validation","validationCode":"func validAlbumTitle(name string) bool {\n    r := []rune(name)\n    if len(r) == 0 || len(r) > 50 {\n        return false\n    }\n    for _, c := range r {\n        if c > 0xFFFF { // surrogate-range / exotic chars Baidu rejects\n            return false\n        }\n    }\n    return true\n}\n\nif !validAlbumTitle(dirName) {\n    return fmt.Errorf(\"album name must be 1-50 safe characters\")\n}\nd.CreateAlbum(ctx, dirName)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enforce a 50-character limit in UI inputs for album create/rename","When mirroring foreign folder trees, derive short album names instead of using raw paths","Strip emoji before sending titles"],"tags":["baidu-photo","validation","album","api"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}