diff --git a/packages/client-core/src/common/services/FileThumbnailJobState.tsx b/packages/client-core/src/common/services/FileThumbnailJobState.tsx index 96f65cb962..148bac50a5 100644 --- a/packages/client-core/src/common/services/FileThumbnailJobState.tsx +++ b/packages/client-core/src/common/services/FileThumbnailJobState.tsx @@ -158,6 +158,12 @@ export const FileThumbnailJobState = defineState({ if (seenResources.has(resource.key)) continue seenResources.add(resource.key) + if (resource.type === 'thumbnail') { + //set thumbnail's thumbnail as itself + Engine.instance.api.service(staticResourcePath).patch(resource.id, { thumbnailKey: resource.key }) + continue + } + if (resource.thumbnailKey != null || !extensionCanHaveThumbnail(resource.key.split('.').pop() ?? '')) continue getMutableState(FileThumbnailJobState).merge([ diff --git a/packages/server-core/src/projects/project/project-helper.ts b/packages/server-core/src/projects/project/project-helper.ts index fe7121309d..a40a792edd 100644 --- a/packages/server-core/src/projects/project/project-helper.ts +++ b/packages/server-core/src/projects/project/project-helper.ts @@ -1784,9 +1784,15 @@ export const uploadLocalProjectToProvider = async ( const stats = await getStats(fileResult, contentType) const resourceInfo = resourcesJson?.[filePathRelative] const type = isScene ? 'scene' : getResourceType(filePathRelative, resourceInfo!) - const thumbnailKey = - resourceInfo?.thumbnailKey ?? (isScene ? key.split('.').slice(0, -1).join('.') + '.thumbnail.jpg' : undefined) - + let thumbnailKey = resourceInfo?.thumbnailKey + if (!thumbnailKey) { + if (isScene) { + thumbnailKey = key.split('.').slice(0, -1).join('.') + '.thumbnail.jpg' + } else if (type === 'thumbnail') { + //since thumbnails are not in resource json, we need to redefine their thumbnail keys here + thumbnailKey = key + } + } if (existingKeySet.has(key)) { const id = existingKeySet.get(key)! existingKeySet.delete(key)