{"record":{"id":"ba024e3084d741f9","repo":"siyuan-note/siyuan","slug":"no-entry","errorCode":null,"errorMessage":"no entry","messagePattern":"no entry","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kernel/model/upload.go","lineNumber":529,"sourceCode":"\t\t\t\tfName = newAssetFileName(fName)\n\t\t\t\ttmpDir2 := filepath.Join(util.TempDir, \"convert\", \"zip\", gulu.Rand.String(7))\n\t\t\t\tif err = gulu.Zip.Unzip(writePath, tmpDir2); err != nil {\n\t\t\t\t\trecordFailure(index, file.Filename, fName, err)\n\t\t\t\t\t_ = os.RemoveAll(tmpDir)\n\t\t\t\t\t_ = os.RemoveAll(tmpDir2)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tentries, readErr := readRTFDDir(tmpDir2)\n\t\t\t\tif nil != readErr {\n\t\t\t\t\trecordFailure(index, file.Filename, fName, readErr)\n\t\t\t\t\t_ = os.RemoveAll(tmpDir)\n\t\t\t\t\t_ = os.RemoveAll(tmpDir2)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif 1 > len(entries) {\n\t\t\t\t\tlogging.LogErrorf(\"read dir [%s] failed: no entry\", tmpDir2)\n\t\t\t\t\tnoEntryErr := errors.New(\"no entry\")\n\t\t\t\t\trecordFailure(index, file.Filename, fName, noEntryErr)\n\t\t\t\t\t_ = os.RemoveAll(tmpDir)\n\t\t\t\t\t_ = os.RemoveAll(tmpDir2)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tdirName := entries[0].Name()\n\t\t\t\tsrcDir := filepath.Join(tmpDir2, dirName)\n\t\t\t\tentries, readErr = readRTFDDir(srcDir)\n\t\t\t\tif nil != readErr {\n\t\t\t\t\trecordFailure(index, file.Filename, fName, readErr)\n\t\t\t\t\t_ = os.RemoveAll(tmpDir)\n\t\t\t\t\t_ = os.RemoveAll(tmpDir2)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tdestDir := filepath.Join(assetsDirPath, fName)\n\t\t\t\tif copyErr := copyRTFDEntries(entries, srcDir, destDir, gulu.File.Copy); nil != copyErr {\n\t\t\t\t\tlogging.LogErrorf(\"copy RTFD directory [%s] failed: %s\", srcDir, copyErr)\n\t\t\t\t\trecordFailure(index, file.Filename, fName, copyErr)","sourceCodeStart":511,"sourceCodeEnd":547,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/upload.go#L511-L547","documentation":"During UploadAssets, when an uploaded .rtfd.zip archive is unzipped, the kernel reads the extracted directory expecting at least one RTFD entry. If the extracted directory is empty (no entries), it records 'no entry' as the failure reason for that file, cleans up the temp dirs, and continues with the remaining files. It guards against malformed or empty RTFD zip uploads.","triggerScenarios":"Uploading a .rtfd.zip file whose archive contains no inner RTFD directory entries — e.g. an empty zip, a zip whose top-level entry is a plain file rather than the expected <name>.rtfd directory, or an archive already pruned by another tool. The error is returned per-file in the upload result's failed list, not as a thrown exception.","commonSituations":"Users drag Apple Pages/TextEdit RTFD exports that were re-zipped incorrectly (zipping the files inside the .rtfd instead of the .rtfd bundle itself), producing a zip with no recognizable top-level directory.","solutions":["Re-create the zip so it contains the <name>.rtfd directory bundle at the archive root (zip -r foo.rtfd.zip foo.rtfd)","Check the failed files in the UploadAssets response to confirm which upload failed, then re-upload a corrected archive","If the content is plain files, upload them individually instead of as an RTFD zip"],"exampleFix":"// before: zip containing loose files\nmydoc.rtfd.zip\n  ├─ TXT.rtf\n  └─ image.png\n// after: zip containing the .rtfd bundle\nmydoc.rtfd.zip\n  └─ mydoc.rtfd/\n       ├─ TXT.rtf\n       └─ image.png","handlingStrategy":"validation","validationCode":"// before upload, verify the RTFD zip has a top-level directory entry\nentries, err := zip.OpenReader(path)\nif err == nil {\n    defer entries.Close()\n    hasDir := false\n    for _, f := range entries.File {\n        if strings.HasSuffix(f.Name, \".rtfd/\") { hasDir = true; break }\n    }\n    if !hasDir { return fmt.Errorf(\"%s is not a valid .rtfd.zip bundle\", path) }\n}","typeGuard":null,"tryCatchPattern":"// inspect per-file failures in the upload result\nresult, _ := UploadAssets(...)\nfor _, f := range result.FailedFiles {\n    if f.Err.Error() == \"no entry\" { /* re-zip and retry that file */ }\n}","preventionTips":["Zip the .rtfd bundle itself, not the files inside it","Test RTFD zips by listing top-level entries before uploading","Show users a clear message when an RTFD upload fails in the errFiles/failed list"],"tags":["upload","zip","rtfd","empty-archive"],"backgroundTag":"empty-result-set","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"}