fix(sort): explorer-like ordering for leading-zero prefixes - #3047
Merged
Conversation
AlexAndBear
force-pushed
the
issues/2993-2
branch
4 times, most recently
from
August 6, 2026 15:57
b321bc0 to
0442e1b
Compare
AlexAndBear
force-pushed
the
issues/2993-2
branch
from
August 6, 2026 19:35
4b89c5c to
3f51d93
Compare
JammingBen
approved these changes
Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes sorting for files and folders with leading-zero prefixes (e.g.,
00000_*,0000_*,00_*,0_*) to match Windows Explorer behavior.Problem
The web client uses natural sorting with
Intl.Collatorandnumeric: true, which treats different numbers of leading zeros as the same numeric value (0). This breaks intentional ordering schemes where users rely on distinct zero prefixes to organize their files.Example:
00000_Important,0000_Archive,00_Projects,0_Otherwere all treated as starting with0and sorted only by the text after the prefix.Solution
Added special handling in
useSort.tsfor names with leading-zero prefixes:^(0+)(?!\d)(.*)$identifies pure zero prefixesExamples
With fix (ascending):
00000_ITEM_ALPHA0000_BLOCK_ALPHA00_SET_ALPHA0_NODE_ALPHARegular names still work naturally:
file1,file01,file001,file2,file02, ...What Stays the Same
Testing
useSort.spec.tswith anonymized zero-prefix datasetsCloses #2993