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

View File

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