fix: self-heal missing library root on access; accept .zip in admin upload picker

This commit is contained in:
2026-09-07 20:16:26 +08:00
parent 6b3a4e5240
commit 505f660dbd
2 changed files with 6 additions and 2 deletions
+4
View File
@@ -26,6 +26,10 @@ func (a *api) libRoot(c *gin.Context, lib store.Library) (string, bool) {
err(c, http.StatusForbidden, "forbidden", "library root outside books dir")
return "", false
}
if e := os.MkdirAll(root, 0o755); e != nil { // 注册库时目录可能尚未落盘,自愈
err(c, http.StatusInternalServerError, "internal", "library root")
return "", false
}
return root, true
}
+2 -2
View File
@@ -83,7 +83,7 @@ export default function AdminLibraries() {
}}
type="file"
multiple
accept=".cbz,.pdf,.epub,.txt,.md"
accept=".cbz,.zip,.pdf,.epub,.txt,.md"
className="hidden"
onChange={(e) => {
void onFiles(l.id, e.target.files);
@@ -93,7 +93,7 @@ export default function AdminLibraries() {
<button className={btn} onClick={() => fileRefs.current[l.id]?.click()}>
上传文件
</button>
<span className="text-xs text-zinc-600">白名单:cbz/pdf/epub/txt/md</span>
<span className="text-xs text-zinc-600">白名单:cbz/zip/pdf/epub/txt/md</span>
</div>
</div>
))}