siyuan-note/siyuan · warning
directory assets are not supported in encrypted notebooks
Error message
directory assets are not supported in encrypted notebooks
What it means
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.
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
Example fix
// before
upload("/path/to/notes.rtfd.zip", id=encryptedDocID) // rejected
// after
for _, img := range extractRTFDImages("/path/to/notes.rtfd.zip") {
upload(img, id=encryptedDocID) // plain files are supported
} Defensive patterns
Strategy: fallback
Validate before calling
// on macOS, detect directory-asset uploads targeting an encrypted box ahead of time
if isMac && strings.HasSuffix(fileName, ".rtfd.zip") && model.IsEncryptedBox(boxID) {
return errors.New("unpack the RTFD and upload inner files individually")
} Try / catch
result, msg, err := model.UploadAssets(req)
for _, f := range result.FailedFiles {
if f.Error == "directory assets are not supported in encrypted notebooks" {
// fallback: convert RTFD to individual file uploads
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- conditional replacement of encrypted attribute views is not…
- Conf.Language(313)
- Conf.Language(313)
- Conf.Language(313)
- Conf.Language(386)
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/3b65971d5de624fe.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/model/upload.go:433
if gulu.OS.IsDarwin() {
if strings.HasSuffix(baseName, ".rtfd.zip") {
needUnzip2Dir = true
}
}
fName := baseName
fName = util.FilterUploadFileName(fName)
ext := filepath.Ext(fName)
fName = strings.TrimSuffix(fName, ext)
ext = strings.ToLower(ext)
fName += ext
f, openErr := file.Open()
if nil != openErr {
recordFailure(index, file.Filename, fName, openErr)
continue
}
if needUnzip2Dir && IsEncryptedBox(uploadBoxID) {
unsupportedErr := errors.New("directory assets are not supported in encrypted notebooks")
recordFailure(index, file.Filename, fName, unsupportedErr)
f.Close()
continue
}
hash, hashErr := util.GetEtagByHandle(f, file.Size)
if nil != hashErr {
recordFailure(index, file.Filename, fName, hashErr)
f.Close()
continue
}
if 1 > file.Size {
hash = "random_1_" + gulu.Rand.String(12)
}
existAssetPath := GetAssetPathByHash(hash, uploadBoxID)
if "" != existAssetPath {View on GitHub (pinned to 9f775e8a12)