diff --git a/src/backend/src/filesystem/FSNodeContext.js b/src/backend/src/filesystem/FSNodeContext.js index 48e3112a..11f66b76 100644 --- a/src/backend/src/filesystem/FSNodeContext.js +++ b/src/backend/src/filesystem/FSNodeContext.js @@ -164,6 +164,18 @@ module.exports = class FSNodeContext { if ( this.found === false ) return undefined; return ! this.entry.parent_uid; } + + async isAppDataDirectory () { + if ( this.isRoot ) return false; + if ( this.found === undefined ) { + await this.fetchEntry(); + } + if ( this.isRoot ) return false; + + const components = await this.getPathComponents(); + if ( components.length < 2 ) return false; + return components[1] === 'AppData'; + } async isPublic () { if ( this.isRoot ) return false; @@ -175,7 +187,19 @@ module.exports = class FSNodeContext { async getPathComponents () { if ( this.isRoot ) return []; - + + // We can get path components for non-existing nodes if they + // have a path selector + if ( ! await this.exists() ) { + if ( this.selector instanceof NodePathSelector ) { + let path = this.selector.value; + if ( path.startsWith('/') ) path = path.slice(1); + return path.split('/'); + } + + // TODO: add support for NodeChildSelector as well + } + let path = await this.get('path'); if ( path.startsWith('/') ) path = path.slice(1); return path.split('/'); diff --git a/src/backend/src/filesystem/hl_operations/hl_write.js b/src/backend/src/filesystem/hl_operations/hl_write.js index 4744040a..70db8838 100644 --- a/src/backend/src/filesystem/hl_operations/hl_write.js +++ b/src/backend/src/filesystem/hl_operations/hl_write.js @@ -299,7 +299,9 @@ class HLWrite extends HLFilesystemOperation { this.checkpoint('before thumbnail'); let thumbnail_promise = new TeePromise(); - (async () => { + if ( await destination.isAppDataDirectory() ) { + thumbnail_promise.resolve(undefined); + } else (async () => { const reason = await (async () => { const { mime } = this.modules; const thumbnails = context.get('services').get('thumbnails');