Selaa lähdekoodia

[web] fix preparing clsi-cache when cloning project (#31169)

* [web] fix preparing clsi-cache when cloning project

* [monorepo] fix downloads from non-sharded clsi-cache

* [web] gracefully handle missing imageName when creating template

GitOrigin-RevId: 8647d1bb95edbedcd43cb6f9d9bc475f56e402c8
Jakob Ackermann 6 kuukautta sitten
vanhempi
sitoutus
774d8434d8

+ 0 - 1
services/web/app/src/Features/Compile/ClsiCacheHandler.mjs

@@ -241,7 +241,6 @@ async function prepareCacheSource(
   userId,
   { sourceProjectId, templateVersionId, imageName, lastUpdated, shard, signal }
 ) {
-  imageName = Path.basename(imageName)
   const url = new URL(
     `/project/${projectId}/user/${userId}/import-from`,
     Settings.apis.clsiCache.instances.find(i => i.shard === shard).url

+ 2 - 1
services/web/app/src/Features/Templates/TemplatesManager.mjs

@@ -15,6 +15,7 @@ import crypto from 'node:crypto'
 import Errors from '../Errors/Errors.js'
 import { pipeline } from 'node:stream/promises'
 import ClsiCacheManager from '../Compile/ClsiCacheManager.mjs'
+import Path from 'node:path'
 
 const { promises: ProjectRootDocManager } = ProjectRootDocManagerModule
 const { promises: ProjectOptionsHandler } = ProjectOptionsHandlerModule
@@ -76,7 +77,7 @@ const TemplatesManager = {
       const prepareClsiCacheInBackground = ClsiCacheManager.prepareClsiCache(
         project._id,
         userId,
-        { templateVersionId, imageName }
+        { templateVersionId, imageName: imageName && Path.basename(imageName) }
       ).catch(err => {
         logger.warn(
           { err, templateVersionId, projectId: project._id },