Uses SFTP readdir as primary method for listing files
Falls back to ls -la when SFTP is unavailable
Enables file manager to work on MikroTik RouterOS and other non-Linux systems
Root Cause
MikroTik devices run RouterOS, which doesn't have standard Linux commands like ls. The file manager was using ls -la exclusively, causing failures on non-Linux systems.
Changes
Added modeToPermissions() helper to convert POSIX mode to permission string
Added formatMtime() helper to format Unix timestamps like ls -la output
Refactored /ssh/file_manager/ssh/listFiles to use trySFTP + tryFallbackMethod pattern
SFTP readlink() is used to resolve symlink targets
Data Format Notes
Field
SFTP
ls -la fallback
owner/group
uid/gid numbers
username/groupname
permissions
converted from mode
direct string
linkTarget
via readlink()
parsed from " -> "
Test plan
Test on MikroTik device - should now display file list
Test on Linux server - should work with SFTP (preferred) or fallback
Test with symlinks - linkTarget should be resolved
## Summary
- Uses SFTP `readdir` as primary method for listing files
- Falls back to `ls -la` when SFTP is unavailable
- Enables file manager to work on MikroTik RouterOS and other non-Linux systems
## Root Cause
MikroTik devices run RouterOS, which doesn't have standard Linux commands like `ls`. The file manager was using `ls -la` exclusively, causing failures on non-Linux systems.
## Changes
- Added `modeToPermissions()` helper to convert POSIX mode to permission string
- Added `formatMtime()` helper to format Unix timestamps like ls -la output
- Refactored `/ssh/file_manager/ssh/listFiles` to use trySFTP + tryFallbackMethod pattern
- SFTP `readlink()` is used to resolve symlink targets
## Data Format Notes
| Field | SFTP | ls -la fallback |
|-------|------|-----------------|
| owner/group | uid/gid numbers | username/groupname |
| permissions | converted from mode | direct string |
| linkTarget | via readlink() | parsed from " -> " |
## Test plan
- [ ] Test on MikroTik device - should now display file list
- [ ] Test on Linux server - should work with SFTP (preferred) or fallback
- [ ] Test with symlinks - linkTarget should be resolved
- [ ] Test permission display (755, 644, etc.)
Fixes Termix-SSH/Support#317
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
readdiras primary method for listing filesls -lawhen SFTP is unavailableRoot Cause
MikroTik devices run RouterOS, which doesn't have standard Linux commands like
ls. The file manager was usingls -laexclusively, causing failures on non-Linux systems.Changes
modeToPermissions()helper to convert POSIX mode to permission stringformatMtime()helper to format Unix timestamps like ls -la output/ssh/file_manager/ssh/listFilesto use trySFTP + tryFallbackMethod patternreadlink()is used to resolve symlink targetsData Format Notes
Test plan
Fixes Termix-SSH/Support#317