{"record":{"id":"ba25f11a06d70b6f","repo":"siyuan-note/siyuan","slug":"renaming-assets-in-encrypted-notebooks-is-not-supp","errorCode":null,"errorMessage":"renaming assets in encrypted notebooks is not supported","messagePattern":"renaming assets in encrypted notebooks is not supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/assets.go","lineNumber":1654,"sourceCode":"\tutil.RemoveAssetText(relativePath)\n\n\tIncSync()\n\n\tindexHistoryDir(filepath.Base(historyDir), util.NewLute())\n\tcache.RemoveAsset(relativePath)\n\treturn\n}\n\nfunc RenameAsset(oldPath, newName string) (newPath string, err error) {\n\tutil.PushEndlessProgress(Conf.Language(110))\n\tdefer util.PushClearProgress()\n\n\toldCleanPath := AssetPathWithoutQuery(oldPath)\n\n\t// 加密笔记本的资源磁盘文件名参与 AAD，重命名需要重新封装密文，当前不支持。\n\tif absPath, absErr := GetAssetAbsPathInBox(oldPath, \"\"); absErr == nil {\n\t\tif IsEncryptedAssetPath(absPath) {\n\t\t\terr = errors.New(\"renaming assets in encrypted notebooks is not supported\")\n\t\t\treturn\n\t\t}\n\t}\n\n\tnewName = strings.TrimSpace(newName)\n\tnewName = util.FilterUploadFileName(newName)\n\tif path.Base(oldCleanPath) == newName {\n\t\treturn\n\t}\n\tif \"\" == newName {\n\t\treturn\n\t}\n\n\tif !gulu.File.IsValidFilename(newName) {\n\t\terr = errors.New(Conf.Language(151))\n\t\treturn\n\t}\n","sourceCodeStart":1636,"sourceCodeEnd":1672,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/assets.go#L1636-L1672","documentation":"Renaming an asset that lives inside an encrypted notebook is rejected. In encrypted notebooks the asset's on-disk filename participates in the AES-GCM AAD, so renaming would require re-encrypting/re-wrapping the ciphertext, which the current implementation does not support. The kernel returns this error early and leaves the asset unchanged.","triggerScenarios":"Calling the asset rename API (model.RenameAsset) where GetAssetAbsPathInBox resolves the old path into an encrypted box and IsEncryptedAssetPath(absPath) is true.","commonSituations":"Users of encrypted-notebook workspaces trying to rename a misplaced asset via right-click rename in the assets panel; scripts or plugins calling the rename endpoint on encrypted-notebook assets.","solutions":["Move the asset out of the encrypted notebook into a normal notebook's assets folder and rename it there","Delete the asset and re-upload it with the desired filename","Disable encryption for the notebook if encrypted assets are not required (understand the security trade-off), then rename","Wait for/upgrade to a SiYuan version that supports re-wrapping encrypted asset names"],"exampleFix":"// before: rename inside encrypted notebook -> error\nrenameAsset('/data/notebooks/enc/assets/old.png', 'new.png')\n// after: copy to a plaintext notebook, rename there\nmoveAssetToPlainNotebook('/data/notebooks/enc/assets/old.png'); renameAsset(newPlainPath, 'new.png')","handlingStrategy":"validation","validationCode":"// check the asset is not in an encrypted notebook before renaming\nconst isEnc = await isEncryptedNotebookAsset(assetPath);\nif (isEnc) throw new Error('rename not supported for encrypted-notebook assets');","typeGuard":null,"tryCatchPattern":"try { await renameAsset(oldPath, newName) } catch (e) {\n  if (e.message.includes('encrypted notebooks')) {\n    offerMoveToPlainNotebookFlow();\n  }\n}","preventionTips":["Track which notebooks are encrypted in your plugin and disable rename UI for their assets","Re-upload assets with the correct name instead of renaming in encrypted notebooks"],"tags":["encryption","assets","unsupported"],"backgroundTag":"unsupported-operation","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"}