From 3fec2ed351c63fe91ecad53c8a9cd0c3db376bf7 Mon Sep 17 00:00:00 2001 From: Neal Shah <30693865+ProgrammerIn-wonderland@users.noreply.github.com> Date: Sun, 16 Nov 2025 21:38:48 -0500 Subject: [PATCH] Move thumbnail mutation to getSafeEntry (#1980) --- src/backend/src/filesystem/FSNodeContext.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/src/filesystem/FSNodeContext.js b/src/backend/src/filesystem/FSNodeContext.js index c8436e065..82e119809 100644 --- a/src/backend/src/filesystem/FSNodeContext.js +++ b/src/backend/src/filesystem/FSNodeContext.js @@ -288,7 +288,6 @@ module.exports = class FSNodeContext { * @void */ async fetchEntry (fetch_entry_options = {}) { - const svc_event = this.services.get('event'); if ( this.fetching !== null ) { await Context.get('services').get('traceService').spanify('fetching', async () => { // ???: does this need to be double-checked? I'm not actually sure... @@ -309,9 +308,6 @@ module.exports = class FSNodeContext { ) { const promise = this.fetching; this.fetching = null; - if (this.entry.thumbnail) { - await svc_event.emit("thumbnail.read", this.entry); - } promise.resolve(); return; } @@ -360,7 +356,6 @@ module.exports = class FSNodeContext { const promise = this.fetching; this.fetching = null; - await svc_event.emit("thumbnail.read", this.entry); promise.resolve(); } @@ -786,6 +781,8 @@ module.exports = class FSNodeContext { } async getSafeEntry(fetch_options = {}) { + const svc_event = this.services.get('event'); + if ( this.found === false ) { throw new Error(`Tried to get entry of non-existent fsentry: ` + this.selector.describe(true)); @@ -794,6 +791,9 @@ module.exports = class FSNodeContext { const res = this.entry; const fsentry = {}; + if (res.thumbnail) { + await svc_event.emit("thumbnail.read", this.entry); + } // This property will not be serialized, but it can be checked // by other code to verify that API calls do not send