{"record":{"id":"3b65971d5de624fe","repo":"siyuan-note/siyuan","slug":"directory-assets-are-not-supported-in-encrypted-no","errorCode":null,"errorMessage":"directory assets are not supported in encrypted notebooks","messagePattern":"directory assets are not supported in encrypted notebooks","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/upload.go","lineNumber":366,"sourceCode":"\t\tif gulu.OS.IsDarwin() {\n\t\t\tif strings.HasSuffix(baseName, \".rtfd.zip\") {\n\t\t\t\tneedUnzip2Dir = true\n\t\t\t}\n\t\t}\n\n\t\tfName := baseName\n\t\tfName = util.FilterUploadFileName(fName)\n\t\text := filepath.Ext(fName)\n\t\tfName = strings.TrimSuffix(fName, ext)\n\t\text = strings.ToLower(ext)\n\t\tfName += ext\n\t\tf, openErr := file.Open()\n\t\tif nil != openErr {\n\t\t\trecordFailure(index, file.Filename, fName, openErr)\n\t\t\tcontinue\n\t\t}\n\t\tif needUnzip2Dir && IsEncryptedBox(uploadBoxID) {\n\t\t\tunsupportedErr := errors.New(\"directory assets are not supported in encrypted notebooks\")\n\t\t\trecordFailure(index, file.Filename, fName, unsupportedErr)\n\t\t\tf.Close()\n\t\t\tcontinue\n\t\t}\n\n\t\thash, hashErr := util.GetEtagByHandle(f, file.Size)\n\t\tif nil != hashErr {\n\t\t\trecordFailure(index, file.Filename, fName, hashErr)\n\t\t\tf.Close()\n\t\t\tcontinue\n\t\t}\n\n\t\tif 1 > file.Size {\n\t\t\thash = \"random_1_\" + gulu.Rand.String(12)\n\t\t}\n\n\t\texistAssetPath := GetAssetPathByHash(hash, uploadBoxID)\n\t\tif \"\" != existAssetPath {","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/upload.go#L348-L384","documentation":"In the Upload handler, when files are uploaded with the unzip-to-directory flag (needUnzip2Dir, e.g. .zip/.rtfd bundles), the target notebook must not be an encrypted notebook. Encrypted notebooks cannot store a directory of extracted assets, so the upload of that file is recorded as a failure with \"directory assets are not supported in encrypted notebooks\" and skipped.","triggerScenarios":"Calling the asset upload API (Upload) against a document in an encrypted notebook while uploading an archive/dir-type asset that triggers needUnzip2Dir (e.g. .rtfd or .zip directory assets).","commonSituations":"Dragging an Apple RTFD bundle into the editor while the target notebook is encrypted; automation scripts uploading directory-style assets to an encrypted box.","solutions":["Upload such assets to a non-encrypted notebook instead.","Convert the directory asset to single flat files (e.g. export RTFD contents as individual images) and upload those individually.","Disable encryption for the notebook if directory asset support there is required (weighing the loss of encryption)."],"exampleFix":"// before\nuploadMultipart(targetDocID, \"note.rtfd\") // encrypted box -> failure\n// after\nfor _, img := range extractRTFDImages(\"note.rtfd\") {\n    uploadMultipart(targetDocID, img) // plain files are supported\n}","handlingStrategy":"fallback","validationCode":"if model.IsEncryptedBox(boxID) && needUnzip2Dir {\n    return fmt.Errorf(\"directory assets are not supported in encrypted notebooks; upload plain files instead\")\n}","typeGuard":null,"tryCatchPattern":"result, err := model.Upload(...) // inspect per-file failures\nfor _, f := range result.FailedFiles {\n    if strings.Contains(f.Error, \"not supported in encrypted notebooks\") {\n        for _, flat := range flattenDirectoryAsset(f.Name) {\n            uploadSingleFile(boxID, flat) // fallback: upload plain files\n        }\n    }\n}","preventionTips":["Check whether the target notebook is encrypted before offering directory-asset uploads in tooling.","Prefer uploading individual image files over bundles when targeting encrypted notebooks.","Document the limitation wherever RTFD/zip uploads are automated."],"tags":["encrypted-notebook","unsupported-operation","assets"],"backgroundTag":"unsupported-operation","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}