{"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":"warning","filePath":"kernel/model/upload.go","lineNumber":433,"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":415,"sourceCodeEnd":451,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/upload.go#L415-L451","documentation":"On macOS, .rtfd.zip uploads are unpacked into a directory of files (needUnzip2Dir). Encrypted notebooks store assets as individually encrypted files with obfuscated names and do not support directory assets, so when the upload target box is encrypted the file is rejected per-file with this error and skipped; the rest of the batch continues.","triggerScenarios":"Uploading a macOS RTFD bundle (.rtfd.zip) via /api/asset/upload into a document/box resolved to an encrypted notebook (uploadBoxID is an encrypted box) — the unzip-to-directory path is unsupported there.","commonSituations":"Drag-dropping a rich-text RTFD attachment from macOS Notes/Pages into a SiYuan editor backed by an encrypted notebook; automated scripts pushing .rtfd.zip bundles into encrypted boxes.","solutions":["Convert the RTFD content to regular files (e.g. export images individually) and upload those instead of the .rtfd.zip bundle","Upload the RTFD into a non-encrypted notebook, or temporarily target a standard notebook for that asset","Read the RTFD and upload its inner files one by one (each is a plain file asset, which encrypted boxes do support)","Check per-file results: the failure is recorded in failedFiles/errFiles while other uploads succeed","If directory assets in encrypted notebooks are required, file a feature request at siyuan-note/siyuan"],"exampleFix":"// before\nupload(\"/path/to/notes.rtfd.zip\", id=encryptedDocID) // rejected\n// after\nfor _, img := range extractRTFDImages(\"/path/to/notes.rtfd.zip\") {\n    upload(img, id=encryptedDocID) // plain files are supported\n}","handlingStrategy":"fallback","validationCode":"// on macOS, detect directory-asset uploads targeting an encrypted box ahead of time\nif isMac && strings.HasSuffix(fileName, \".rtfd.zip\") && model.IsEncryptedBox(boxID) {\n    return errors.New(\"unpack the RTFD and upload inner files individually\")\n}","typeGuard":null,"tryCatchPattern":"result, msg, err := model.UploadAssets(req)\nfor _, f := range result.FailedFiles {\n    if f.Error == \"directory assets are not supported in encrypted notebooks\" {\n        // fallback: convert RTFD to individual file uploads\n    }\n}","preventionTips":["Convert macOS RTFD bundles to individual image/file uploads before sending to encrypted notebooks","Check IsEncryptedBox on the target box when uploading .rtfd.zip on macOS","Inspect failedFiles per-file results instead of assuming the whole upload failed"],"tags":["encrypted-notebook","unsupported-operation","upload","macos"],"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"}