Skip to content

[Bug] Default File Naming Patterns let Files without Metadata clump up into a single book #308

Description

@itsjakobx

What went wrong?

The current default file naming patterns can have files without metadata to clump up into a single book.

I propose adding |{originalFilename} as a fallback to the {title} placeholder in the default patterns:

something like this:

diff --git a/packages/types/src/pattern-resolver.ts b/packages/types/src/pattern-resolver.ts
index 3b100797..46f96a6d 100644
--- a/packages/types/src/pattern-resolver.ts
+++ b/packages/types/src/pattern-resolver.ts
@@ -1,6 +1,6 @@
-export const DEFAULT_UPLOAD_PATTERN_BOOK_PER_FILE = "<{authors:first}|Unknown Author>/<{series}/><{seriesIndex}. >{title}< ({year})>";
+export const DEFAULT_UPLOAD_PATTERN_BOOK_PER_FILE = "<{authors:first}|Unknown Author>/<{series}/><{seriesIndex}. ><{title}|{originalFilename}>< ({year})>";
 export const DEFAULT_UPLOAD_PATTERN_BOOK_PER_FOLDER =
-  "<{authors:first}|Unknown Author>/<{series}/><{seriesIndex}. >{title}< ({year})>/<{seriesIndex}. >{title}< ({year})>";
+  "<{authors:first}|Unknown Author>/<{series}/><{seriesIndex}. ><{title}|{originalFilename}>< ({year})>/<{seriesIndex}. ><{title}|{originalFilename}>< ({year})>";
 export const DEFAULT_DOWNLOAD_PATTERN = "{originalFilename}";

 export const EXAMPLE_PATTERN_METADATA: Record<string, string> = {

Steps to reproduce

  1. use default patterns and cleanup metadata of 2 files
exiftool -all= "your_book.epub"
  1. Upload 2 files, and see that they have become one book.
  2. Mode should be Folders a Books

Expected vs actual behavior

Files should upload into different books

Your setup

BookOrbit version/image tag: ghcr.io/bookorbit/bookorbit:latest
Deployment: Docker
OS: Ubuntu 22.04 (Assuming the host OS matches your docker-node-1 environment)
Browser: Firefox 124

Relevant logs (optional)

Screenshots (optional)

Image

Before submitting

  • I've searched existing issues and this hasn't been reported yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleasedIssue or PR is included in a released version.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions