fix: self-heal missing library root on access; accept .zip in admin upload picker
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user