Drop PDF support, EPUB only
Docker Image bauen und veröffentlichen / docker (push) Successful in 2m38s
Docker Image bauen und veröffentlichen / docker (push) Successful in 2m38s
- internal/library: ListBooks only scans .epub files, dropping the pdf-specific metadata branch (epub metadata reading is now unconditional) - internal/web: uploadSubmit rejects non-.epub uploads with updated error message - views: upload form/file input and empty-library hint now reference only EPUB; templ regenerated - README/copilot-instructions updated to reflect EPUB-only scope Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -44,7 +44,7 @@ func (s *Service) ListBooks() ([]Book, error) {
|
||||
}
|
||||
|
||||
ext := strings.ToLower(filepath.Ext(e.Name()))
|
||||
if ext != ".epub" && ext != ".pdf" {
|
||||
if ext != ".epub" {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -55,17 +55,15 @@ func (s *Service) ListBooks() ([]Book, error) {
|
||||
hasCover := false
|
||||
title := fallbackTitle
|
||||
|
||||
if ext == ".epub" {
|
||||
meta, err := readEPUBMetadata(fullPath)
|
||||
if err == nil {
|
||||
if strings.TrimSpace(meta.Title) != "" {
|
||||
title = strings.TrimSpace(meta.Title)
|
||||
}
|
||||
if strings.TrimSpace(meta.Author) != "" {
|
||||
author = strings.TrimSpace(meta.Author)
|
||||
}
|
||||
hasCover = meta.HasCover
|
||||
meta, err := readEPUBMetadata(fullPath)
|
||||
if err == nil {
|
||||
if strings.TrimSpace(meta.Title) != "" {
|
||||
title = strings.TrimSpace(meta.Title)
|
||||
}
|
||||
if strings.TrimSpace(meta.Author) != "" {
|
||||
author = strings.TrimSpace(meta.Author)
|
||||
}
|
||||
hasCover = meta.HasCover
|
||||
}
|
||||
|
||||
books = append(books, Book{
|
||||
|
||||
@@ -210,8 +210,8 @@ func (h *Handler) uploadSubmit(w http.ResponseWriter, r *http.Request) {
|
||||
defer file.Close()
|
||||
|
||||
ext := strings.ToLower(filepath.Ext(header.Filename))
|
||||
if ext != ".epub" && ext != ".pdf" {
|
||||
render(w, r.Context(), views.UploadPage("Nur EPUB- und PDF-Dateien erlaubt."))
|
||||
if ext != ".epub" {
|
||||
render(w, r.Context(), views.UploadPage("Nur EPUB-Dateien erlaubt."))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user