File Browser Pane Strips extra zeros in display list

Bug Report: Filename Sorting Strips Leading Zeros

Application: Obsidian

Operating System: Arch Linux


Summary:

The file directory view in Obsidian incorrectly sorts filenames by stripping leading zeros, causing unexpected ordering of numerically-named files.

Steps to Reproduce:

  1. Create files named:
  • 002.md
  • 1.md
  1. Observe their ordering in the file directory view.

Expected Behavior:

Files should sort numerically based on exact filenames, maintaining leading zeros. Thus, the correct sorting order should be:

  • 002.md
  • 1.md

Actual Behavior:

Leading zeros are stripped when sorting, resulting in the following incorrect order:

  • 1.md
  • 002.md

Current Workaround:

Files need to be named with non-numeric characters to maintain ordering (e.g., renaming 002.md to 0-02.md).

Suggested Resolution:

Ensure that file sorting logic respects leading zeros and treats filenames as literal strings rather than numeric values.


Additional Information:

  • This behavior can disrupt users relying on numeric filenames for structured ordering.

This is not a bug. We are following the same conventions used for sorting filenames employed in most (all?) OSes.