fix: disable thumbnails for AppData uploads

This commit is contained in:
KernelDeimos 2024-10-10 15:02:41 -04:00
parent 823ab28448
commit 37e7b6ad70
2 changed files with 28 additions and 2 deletions

View File

@ -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('/');

View File

@ -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');