From 357f8f7c18ef4aef601ca705c33a687aaa49f3cb Mon Sep 17 00:00:00 2001 From: KrYmZiN <35653831+Shiv-Patil@users.noreply.github.com> Date: Tue, 23 May 2023 18:17:03 +0530 Subject: [PATCH] Update main.ts Add a workaround for when ctime is not stored on the filesystem --- src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 2b4459f..f7b6e62 100644 --- a/src/main.ts +++ b/src/main.ts @@ -77,7 +77,7 @@ export default class PasteImageRenamePlugin extends Plugin { // debugLog('file created', file) if (!(file instanceof TFile)) return - const timeGapMs = (new Date().getTime()) - file.stat.ctime + const timeGapMs = (new Date().getTime()) - (file.stat.ctime ? file.stat.ctime : file.stat.mtime) // if the file is created more than 1 second ago, the event is most likely be fired on vault initialization when starting Obsidian app, ignore it if (timeGapMs > 1000) return