[Bug]: Individual Chapter Files without Leading Zeroes Sorted Incorrectly #2237

Closed
opened 2026-04-25 00:05:18 +02:00 by adam · 3 comments
Owner

Originally created by @CaptainLexington on GitHub (Sep 5, 2024).

What happened?

Most audiobooks with separate MP3 files have leading zeroes in their part number, but if they don't, ABS can sort them wrong when importing them:
image

What did you expect to happen?

The chapters should be sorted in numerical order, probably Natural Sort.

Steps to reproduce the issue

  1. Import more than 10 sequentially-numbered files without leading zeroes on the part numbers.

Audiobookshelf version

2.12.3

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?

None

Logs

No response

Additional Notes

I understand I could rename the files, but that seems like a lot of work considering they come this way from the publisher.

Originally created by @CaptainLexington on GitHub (Sep 5, 2024). ### What happened? Most audiobooks with separate MP3 files have leading zeroes in their part number, but if they don't, ABS can sort them wrong when importing them: ![image](https://github.com/user-attachments/assets/fc54638a-1b70-4b34-9e4b-4c7b0c6dae37) ### What did you expect to happen? The chapters should be sorted in numerical order, probably Natural Sort. ### Steps to reproduce the issue 1. Import more than 10 sequentially-numbered files without leading zeroes on the part numbers. ### Audiobookshelf version 2.12.3 ### 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? None ### Logs _No response_ ### Additional Notes I understand I could rename the files, but that seems like a lot of work considering they come this way from the publisher.
adam added the bug label 2026-04-25 00:05:18 +02:00
adam closed this issue 2026-04-25 00:05:18 +02:00
Author
Owner

@advplyr commented on GitHub (Sep 6, 2024):

Those aren't leading zeros though that is a 0 with a hyphen

@advplyr commented on GitHub (Sep 6, 2024): Those aren't leading zeros though that is a `0` with a hyphen
Author
Owner

@CaptainLexington commented on GitHub (Sep 6, 2024):

Right, I said there aren't leading zeroes. I have since seen other files sorted by natural sort, without weird interposing hyphens, but this does seem like incorrect behavior regardless.

@CaptainLexington commented on GitHub (Sep 6, 2024): Right, I said there _aren't_ leading zeroes. I have since seen other files sorted by natural sort, without weird interposing hyphens, but this does seem like incorrect behavior regardless.
Author
Owner

@advplyr commented on GitHub (Sep 6, 2024):

If you press "Manage Tracks" button you will see what Abs is pulling for the track number and disc number if applicable.

This doesn't have to do with not having leading zeros, it has to do with there being a 0 in the filename before the other number.

@advplyr commented on GitHub (Sep 6, 2024): If you press "Manage Tracks" button you will see what Abs is pulling for the track number and disc number if applicable. This doesn't have to do with not having leading zeros, it has to do with there being a 0 in the filename before the other number.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2237