From bdced601169cc889b1a297b0a966866b5b939f1f Mon Sep 17 00:00:00 2001 From: Sergio Vera Date: Wed, 1 Nov 2023 18:19:18 +0100 Subject: [PATCH] Fixed empty subjects and wrong link in readme --- README.md | 2 +- internal/metadata/epub.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7547637..a288848 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ Some features rely on having an SMTP email service set up, and won't be availabl * Send document to email. * Recover user password. -You can use any email service that allow sending emails using the SMTP protocol, like [GMX](gmx.com). The following environment variables need to be defined: +You can use any email service that allow sending emails using the SMTP protocol, like [GMX](https://gmx.com/mail). The following environment variables need to be defined: * `SMTP_SERVER`: The URL of the SMTP server to be used, for example `mail.gmx.com`. * `SMTP_PORT`: The port number used by the email service, defaults to `587`. diff --git a/internal/metadata/epub.go b/internal/metadata/epub.go index bbd0b24..884216b 100644 --- a/internal/metadata/epub.go +++ b/internal/metadata/epub.go @@ -52,6 +52,10 @@ func (e EpubReader) Metadata(file string) (Metadata, error) { var subjects []string if len(opf.Metadata.Subject) > 0 { for _, subject := range opf.Metadata.Subject { + subject.Value = strings.TrimSpace(subject.Value) + if subject.Value == "" { + continue + } // Some epub files mistakenly put all subjects in a single field instead of using a field for each one. // We want to identify those cases looking for specific separators and then indexing each subject properly. names := strings.Split(subject.Value, ",")