Skip to content

Commit 37e7b6a

Browse files
committed
fix: disable thumbnails for AppData uploads
1 parent 823ab28 commit 37e7b6a

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/backend/src/filesystem/FSNodeContext.js

+25-1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,18 @@ module.exports = class FSNodeContext {
164164
if ( this.found === false ) return undefined;
165165
return ! this.entry.parent_uid;
166166
}
167+
168+
async isAppDataDirectory () {
169+
if ( this.isRoot ) return false;
170+
if ( this.found === undefined ) {
171+
await this.fetchEntry();
172+
}
173+
if ( this.isRoot ) return false;
174+
175+
const components = await this.getPathComponents();
176+
if ( components.length < 2 ) return false;
177+
return components[1] === 'AppData';
178+
}
167179

168180
async isPublic () {
169181
if ( this.isRoot ) return false;
@@ -175,7 +187,19 @@ module.exports = class FSNodeContext {
175187

176188
async getPathComponents () {
177189
if ( this.isRoot ) return [];
178-
190+
191+
// We can get path components for non-existing nodes if they
192+
// have a path selector
193+
if ( ! await this.exists() ) {
194+
if ( this.selector instanceof NodePathSelector ) {
195+
let path = this.selector.value;
196+
if ( path.startsWith('/') ) path = path.slice(1);
197+
return path.split('/');
198+
}
199+
200+
// TODO: add support for NodeChildSelector as well
201+
}
202+
179203
let path = await this.get('path');
180204
if ( path.startsWith('/') ) path = path.slice(1);
181205
return path.split('/');

src/backend/src/filesystem/hl_operations/hl_write.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,9 @@ class HLWrite extends HLFilesystemOperation {
299299
this.checkpoint('before thumbnail');
300300

301301
let thumbnail_promise = new TeePromise();
302-
(async () => {
302+
if ( await destination.isAppDataDirectory() ) {
303+
thumbnail_promise.resolve(undefined);
304+
} else (async () => {
303305
const reason = await (async () => {
304306
const { mime } = this.modules;
305307
const thumbnails = context.get('services').get('thumbnails');

0 commit comments

Comments
 (0)