[Bug]: em spaces are not preserved in chapter editor #2601

Open
opened 2026-02-20 02:19:43 -05:00 by deekerman · 5 comments
Owner

Originally created by @Linden-Ryuujin on GitHub (Dec 14, 2024).

What happened?

If you prefix a chapter name with em spaces they are discarded on save.
em spaces are respected in m4b files, chapter file formats and in the audiobookself player (I use them to indent some chapters, particular if a book container multiple "parts").

e.g.

Part 1: The Start
  Chapter 1: Inside part 1

What did you expect to happen?

Em spaces should not be removed. Possibly all white space could be preserved? The audiobookself chapter format doesn't seem to have the same limitations as M4B (as fully quoted strings are used in the new json meta data files).

Steps to reproduce the issue

  1. Open chapter editor
  2. Begin chapter name with one or more em spaces e.g.   Chapter 1: Inside part 1
  3. Save Changes
  4. Check chapters and em spaces have been discarded.

Audiobookshelf version

v2.17.1

How are you running audiobookshelf?

Docker

What OS is your Audiobookshelf server hosted from?

Linux

If the issue is being seen in the UI, what browsers are you seeing the problem on?

Firefox

Logs

No response

Additional Notes

No response

Originally created by @Linden-Ryuujin on GitHub (Dec 14, 2024). ### What happened? If you prefix a chapter name with em spaces they are discarded on save. em spaces are respected in m4b files, chapter file formats and in the audiobookself player (I use them to indent some chapters, particular if a book container multiple "parts"). e.g. ``` Part 1: The Start   Chapter 1: Inside part 1 ``` ### What did you expect to happen? Em spaces should not be removed. Possibly all white space could be preserved? The audiobookself chapter format doesn't seem to have the same limitations as M4B (as fully quoted strings are used in the new json meta data files). ### Steps to reproduce the issue 1. Open chapter editor 2. Begin chapter name with one or more em spaces e.g. `  Chapter 1: Inside part 1` 3. Save Changes 4. Check chapters and em spaces have been discarded. ### Audiobookshelf version v2.17.1 ### How are you running audiobookshelf? Docker ### What OS is your Audiobookshelf server hosted from? Linux ### If the issue is being seen in the UI, what browsers are you seeing the problem on? Firefox ### Logs _No response_ ### Additional Notes _No response_
Author
Owner

@pwinnski commented on GitHub (Dec 16, 2024):

I am amused by how closely in time this follows #3720, although they are about different metadata.

@pwinnski commented on GitHub (Dec 16, 2024): I am amused by how closely in time this follows #3720, although they are about different metadata.
Author
Owner

@advplyr commented on GitHub (Dec 21, 2024):

Hmm I see what you mean but I wonder if most users would prefer to trim the whitespace. Usually when I see extra whitespace at the end of the string it's because some people instinctively press the spacebar after a word. Trimming trailing whitespace but leaving the leading whitespace could be the middle ground

@advplyr commented on GitHub (Dec 21, 2024): Hmm I see what you mean but I wonder if most users would prefer to trim the whitespace. Usually when I see extra whitespace at the end of the string it's because some people instinctively press the spacebar after a word. Trimming trailing whitespace but leaving the leading whitespace could be the middle ground
Author
Owner

@pwinnski commented on GitHub (Dec 21, 2024):

Is there any harm in preserving all white space? Yes, there might be an unintentional extra space at the end, but people who care about such things could manually remove them, while people who don't care can leave them.

@pwinnski commented on GitHub (Dec 21, 2024): Is there any harm in preserving all white space? Yes, there might be an unintentional extra space at the end, but people who care about such things could manually remove them, while people who don't care can leave them.
Author
Owner

@advplyr commented on GitHub (Dec 21, 2024):

Not really. The only thing I can think of is if the chapter title is only white space.

@advplyr commented on GitHub (Dec 21, 2024): Not really. The only thing I can think of is if the chapter title is only white space.
Author
Owner

@ZLoth commented on GitHub (Feb 6, 2025):

This issue follows closely with the (rejected) feature request https://github.com/advplyr/audiobookshelf/issues/3421 in which a chapter title can be bolded/italicized/underlined to highlight different sections of the book, or for this user's case, indented. This can be part of the metadata.json file:

    {
      "id": 1,
      "start": 299.9673,
      "end": 2029.537856,
      "title": "Chapter 1",
      "format": "bold, indent"
    },
@ZLoth commented on GitHub (Feb 6, 2025): This issue follows closely with the (rejected) feature request https://github.com/advplyr/audiobookshelf/issues/3421 in which a chapter title can be bolded/italicized/underlined to highlight different sections of the book, or for this user's case, indented. This can be part of the metadata.json file: ``` { "id": 1, "start": 299.9673, "end": 2029.537856, "title": "Chapter 1", "format": "bold, indent" }, ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/audiobookshelf#2601
No description provided.