mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
fix: disable thumbnails for AppData uploads
This commit is contained in:
parent
823ab28448
commit
37e7b6ad70
@ -165,6 +165,18 @@ module.exports = class FSNodeContext {
|
||||
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;
|
||||
const components = await this.getPathComponents();
|
||||
@ -176,6 +188,18 @@ 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('/');
|
||||
|
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user