From fe310459dae2886dc884a7ed476b42b187351629 Mon Sep 17 00:00:00 2001 From: monoid Date: Sun, 13 Oct 2024 23:46:17 +0900 Subject: [PATCH] fix: undefined file stat --- packages/server/src/content/file.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/server/src/content/file.ts b/packages/server/src/content/file.ts index d33bbc4..9497db4 100644 --- a/packages/server/src/content/file.ts +++ b/packages/server/src/content/file.ts @@ -68,10 +68,9 @@ export const createDefaultClass = (type: string): ContentFileConstructor => { async getMtime(): Promise { const oldStat = this.getStat(); if (oldStat !== undefined) return oldStat.mtimeMs; - await this.getHash(); - const newStat = this.getStat(); - if (newStat === undefined) throw new Error("stat is undefined"); - return newStat.mtimeMs; + const stat = await promises.stat(this.path); + this.stat = stat; + return stat.mtimeMs; } }; return cons;