Skip to content

Conversation

Copy link

Copilot AI commented Jan 28, 2026

Overview

Short summary of what this PR does

  • Added: ...
  • Updated: ...
  • Removed: ...
  • Fixed: File manager now sorts files alphabetically (directories first, then files)

Changes Made

Files were displayed in filesystem order (ls -U) instead of alphabetically. Added sorting to filteredFiles in FileManager.tsx:

  • Directories sorted before files/links
  • Alphabetical via localeCompare with numeric: true (file2 before file10)
  • Wrapped in useMemo for performance
const filteredFiles = useMemo(
  () =>
    files
      .filter((file) => file.name.toLowerCase().includes(searchQuery.toLowerCase()))
      .sort((a, b) => {
        if (a.type === "directory" && b.type !== "directory") return -1;
        if (a.type !== "directory" && b.type === "directory") return 1;
        return a.name.localeCompare(b.name, undefined, { numeric: true, sensitivity: "base" });
      }),
  [files, searchQuery],
);

Related Issues

Link any issues this PR addresses

Screenshots / Demos

Before: Files in filesystem order (matches ls -U output)
image

After: Directories first, all sorted A-Z with natural number ordering

Checklist

  • Code follows project style guidelines
  • Supports mobile and desktop UI/app (if applicable)
  • I have read Contributing.md
  • This is not a translation request. See docs
Original prompt

This section details on the original issue you should resolve

<issue_title>[BUG] File manager files are not sorted alphabetically</issue_title>
<issue_description>### Title

Files listed are not in alphabetical order, making it confusing to find specific folders

Platform

Website - Firefox

Server Installation Method

Docker

Version

v1.11.0

Troubleshooting

The Problem

The files are not sorted in any particular order, I was able to reproduce the same ordering with ls -U

Image

How to Reproduce

  1. Create multiple files, specifically don't create them in alphabetical order
  2. Execute ls -U
  3. Check termix to find files in same order as ls -U but not alphabetical order

Additional Context

No response</issue_description>

<agent_instructions>Review this issue and develop a solution.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: ZacharyZcR <48591714+ZacharyZcR@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix file manager files sorting issue Fix file manager files not sorted alphabetically Jan 28, 2026
Copilot AI requested a review from ZacharyZcR January 28, 2026 02:14
@ZacharyZcR ZacharyZcR marked this pull request as ready for review January 28, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] File manager files are not sorted alphabetically

2 participants