Configurable list columns via header right-click
Native checkable menu on the column headers toggles Size, Modified, Kind, Rights, Owner and Group (persisted, both panels). Owner/group come from the ls-style SFTP longname remotely and cached uid/gid lookups locally (POSIX; undefined on Windows). All columns sort. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,18 @@ const S_IFMT = 0o170000;
|
||||
const S_IFDIR = 0o040000;
|
||||
const S_IFLNK = 0o120000;
|
||||
|
||||
/**
|
||||
* Owner/group from the ls-style longname openssh sends with each entry
|
||||
* ("-rw-r--r-- 1 root wheel 1024 Jan 1 00:00 name"). Servers aren't
|
||||
* required to use this format — bail to undefined when it doesn't parse.
|
||||
*/
|
||||
function ownerFromLongname(longname: string | undefined): { owner?: string; group?: string } {
|
||||
if (!longname || !/^[-dlbcps]/.test(longname)) return {};
|
||||
const fields = longname.split(/\s+/);
|
||||
if (fields.length < 5) return {};
|
||||
return { owner: fields[2], group: fields[3] };
|
||||
}
|
||||
|
||||
function typeFromMode(mode: number): EntryType {
|
||||
const fmt = mode & S_IFMT;
|
||||
if (fmt === S_IFDIR) return "dir";
|
||||
@@ -132,6 +144,7 @@ export class SftpProvider implements FileSystemProvider {
|
||||
size: e.attrs.size,
|
||||
mtime: e.attrs.mtime * 1000, // sftp attrs are seconds
|
||||
mode: e.attrs.mode & 0o7777,
|
||||
...ownerFromLongname(e.longname),
|
||||
})),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user