d2phap / d2phap/ImageGlass

[Linux] Name sort differs from Dolphin when basename is prefix of another (extension included in compare)

Open Beginner friendly
#2,467 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

👌🏻 ready
Dominant language
C#
Stars
14.4k
Forks
752
Avg merge
10d 14h
Merged PRs (30d)
1

Description

Windows OS version

N/A - CachyOS Linux / KDE Dolphin 26.08.1

ImageGlass version

10.0.6.906 linux-x64 AppImage

ImageGlass release

Classic

1️⃣ Steps to reproduce
  1. Create folder with park.jpg and park 2.jpg (same extension).
  2. In ImageGlass Settings > Image > Image loading order = Name (default), Ascending.
  3. Open park.jpg in ImageGlass, navigate next/prev, or check gallery order.
  4. Compare with Dolphin sorted by Name, or sort -V / ls -v.

Same with park.jpg vs park - 2.jpg.

2️⃣ Actual behavior
  • ImageGlass shows park 2.jpg first, park.jpg second.
  • ImageGlass shows park - 2.jpg first, park.jpg second.
3️⃣ Expected behavior
  • Dolphin / Explorer / sort -V / ls -v show park.jpg first, park 2.jpg second.
  • Dolphin shows park.jpg first, park - 2.jpg second.
4️⃣ Screenshots / Video / Sample image file

No image format issue — filenames suffice:

park.jpg
park 2.jpg
park - 2.jpg
5️⃣ Additional context

Suspected root cause in source/ImageGlass.Lib/Common/ServiceProviders/FileSearchService/FileSearchProvider.cs (SortEntries() / SortFiles()):

.ThenBy(f => Path.GetFileName(f), filePathComparer)

uses full filename with StringNaturalComparer (OrdinalIgnoreCase), so park.jpg vs park 2.jpg compares pos 4: '.' (46) vs ' ' (32). Space wins.

Dolphin/Explorer/sort -V sort basename first, extension second (park is prefix of park 2, shorter-first).

Suggested fix:

.ThenBy(f => Path.GetFileNameWithoutExtension(f), filePathComparer)
.ThenBy(f => Path.GetExtension(f), StringComparer.OrdinalIgnoreCase)

Config: igconfig.json: ImageLoadingOrder: Name, ImageLoadingOrderType: Asc, EnableExplorerSortOrder: false. EnableExplorerSortOrder is Windows-only (Win32FileSearchProvider), so no workaround on Linux.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in source/ImageGlass.Lib/Common/ServiceProviders/FileSearchService/FileSearchProvider.cs, focusing on SortEntries() and SortFiles() and the filename comparer. Reproduce the Linux ordering with park.jpg, park 2.jpg, and park - 2.jpg, then verify that basename-first sorting places park.jpg before the numbered variants in the image loading order.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.