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
@ -164,6 +164,18 @@ module.exports = class FSNodeContext {
|
|||||||
if ( this.found === false ) return undefined;
|
if ( this.found === false ) return undefined;
|
||||||
return ! this.entry.parent_uid;
|
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 () {
|
async isPublic () {
|
||||||
if ( this.isRoot ) return false;
|
if ( this.isRoot ) return false;
|
||||||
@ -175,7 +187,19 @@ module.exports = class FSNodeContext {
|
|||||||
|
|
||||||
async getPathComponents () {
|
async getPathComponents () {
|
||||||
if ( this.isRoot ) return [];
|
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');
|
let path = await this.get('path');
|
||||||
if ( path.startsWith('/') ) path = path.slice(1);
|
if ( path.startsWith('/') ) path = path.slice(1);
|
||||||
return path.split('/');
|
return path.split('/');
|
||||||
|
@ -299,7 +299,9 @@ class HLWrite extends HLFilesystemOperation {
|
|||||||
this.checkpoint('before thumbnail');
|
this.checkpoint('before thumbnail');
|
||||||
|
|
||||||
let thumbnail_promise = new TeePromise();
|
let thumbnail_promise = new TeePromise();
|
||||||
(async () => {
|
if ( await destination.isAppDataDirectory() ) {
|
||||||
|
thumbnail_promise.resolve(undefined);
|
||||||
|
} else (async () => {
|
||||||
const reason = await (async () => {
|
const reason = await (async () => {
|
||||||
const { mime } = this.modules;
|
const { mime } = this.modules;
|
||||||
const thumbnails = context.get('services').get('thumbnails');
|
const thumbnails = context.get('services').get('thumbnails');
|
||||||
|
Loading…
Reference in New Issue
Block a user