{"record":{"id":"029dfaff15714418","repo":"siyuan-note/siyuan","slug":"conf-language-13","errorCode":null,"errorMessage":"Conf.Language(13)","messagePattern":"Conf\\.Language\\(13\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/file.go","lineNumber":2309,"sourceCode":"\tif 512 < utf8.RuneCountInString(title) {\n\t\t// 限制笔记本名和文档名最大长度为 `512` https://github.com/siyuan-note/siyuan/issues/6299\n\t\treturn nil, errors.New(Conf.Language(106))\n\t}\n\n\tisEmpty := false\n\tif \"\" == title {\n\t\ttitle = Conf.Language(16)\n\t\tisEmpty = true\n\t} else if titleEmpty {\n\t\tisEmpty = true\n\t}\n\n\tbaseName := strings.TrimSpace(path.Base(p))\n\tif \"\" == util.GetTreeID(baseName) {\n\t\treturn nil, errors.New(Conf.Language(16))\n\t}\n\tif strings.HasPrefix(baseName, \".\") {\n\t\treturn nil, errors.New(Conf.Language(13))\n\t}\n\n\tbox, boxErr := getOpenedBox(boxID)\n\tif nil != boxErr {\n\t\treturn nil, boxErr\n\t}\n\n\tfolder := path.Dir(p)\n\thPath := \"/\" + title\n\tif \"/\" != folder {\n\t\tparentID := path.Base(folder)\n\t\tparentTree, loadErr := LoadTreeByBlockID(parentID)\n\t\tif nil != loadErr {\n\t\t\tlogging.LogErrorf(\"get parent tree [%s] failed\", parentID)\n\t\t\treturn nil, ErrBlockNotFound\n\t\t}\n\t\tparentPath := strings.TrimSuffix(parentTree.Path, \".sy\")\n\t\tif parentTree.Box != boxID || cleanBoxDocDir(parentPath) != cleanBoxDocDir(folder) {","sourceCodeStart":2291,"sourceCodeEnd":2327,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/file.go#L2291-L2327","documentation":"validateCreateDoc rejects document paths whose basename starts with a dot: errors.New(Conf.Language(13)), \"Cannot create a file starting with .\". Dot-prefixed names are reserved for hidden/system files in the workspace (and would be ignored or mishandled by the indexer and sync), so the kernel forbids creating them as documents.","triggerScenarios":"Calling /api/filetree/createDoc (or createDocWithMd) where the resulting path basename begins with '.', e.g. title='.hidden' or path='/...something'; passing a title like '.env' or '.gitignore' that becomes the doc filename.","commonSituations":"Scripts attempting to store config-like content as docs named '.foo'; clipper/import tools that pass raw filenames including leading dots; users typing names starting with a period when creating docs through API-driven UIs.","solutions":["Strip or replace the leading dot in the title/path basename before the request (e.g. title.replace(/^\\.+/, \"\"))","Prefix dot-files with a safe character if the content must look hidden, e.g. 'dot-env'.","Store such data in the notebook's assets folder or a plugin data directory instead of as a document.","Validate the title client-side with /^[^.]/ before calling the API."],"exampleFix":"// before\nawait fetchPost(\"/api/filetree/createDoc\", { notebook, path, title: \".config\" });\n// after\nconst title = \".config\".replace(/^\\.+/u, \"\") || \"config\";\nawait fetchPost(\"/api/filetree/createDoc\", { notebook, path, title });","handlingStrategy":"validation","validationCode":"if (/^[.]/.test(title.trim())) {\n  title = title.trim().replace(/^\\.+/u, \"\") || \"untitled\";\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Sanitize titles with /^[^.]/ before any create/rename call.","Store hidden/config-like data in assets or plugin data dirs, not as docs.","Share one filename sanitizer across all API call sites."],"tags":["kernel","create-doc","hidden-file","filename-validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}