Don't use mtime directly from BFS
Some checks are pending
Tests / tests (push) Waiting to run

This commit is contained in:
Dustin Brett 2025-03-20 21:24:35 -07:00
parent 47e227047d
commit 1c27444f26
2 changed files with 10 additions and 11 deletions

View File

@ -8,7 +8,7 @@ export type DirectoryEntries = {
description?: string;
href: string;
icon?: string;
modified?: Date;
modified?: number;
size?: number;
};
@ -89,9 +89,9 @@ const formatSize = (size?: number): string => {
return newNumber + (addTrailingZero ? ".0" : "") + units[power];
};
const formatDate = (date?: Date): string =>
date
? getTZOffsetISOString(date.getTime())
const formatDate = (timestamp?: number): string =>
timestamp
? getTZOffsetISOString(timestamp)
.replace("T", " ")
.split(".")[0]
.slice(0, -3)

View File

@ -48,6 +48,7 @@ import {
} from "utils/functions";
import {
getInfoWithExtension,
getModifiedTime,
getShortcutInfo,
} from "components/system/Files/FileEntry/functions";
import { useSession } from "contexts/session";
@ -173,18 +174,18 @@ const Browser: FC<ComponentProcessProps> = ({ id }) => {
}
}
const stats = await stat(
const filePath =
shortcutUrl && (await exists(shortcutUrl))
? shortcutUrl
: href
);
: href;
const stats = await stat(filePath);
const isDir = stats.isDirectory();
return {
description,
href: isDir && shortcutUrl ? shortcutUrl : href,
icon: isDir ? "folder" : undefined,
modified: stats.mtime,
modified: getModifiedTime(filePath, stats),
size: isDir || shortcutUrl ? undefined : stats.size,
};
})
@ -229,9 +230,7 @@ const Browser: FC<ComponentProcessProps> = ({ id }) => {
}
if (column === "M") {
return sortValue(
({ modified }) => modified?.getTime() ?? 0
);
return sortValue(({ modified }) => modified ?? 0);
}
if (column === "D") {