in src/application/ui/src/components/ProductImage.js [218:248]
function getProcessedUrl(imageUrl) {
if (!imageUrl) return PLACEHOLDER_IMAGE;
// Return from cache if available
if (imageUrlCache.has(imageUrl)) {
return imageUrlCache.get(imageUrl);
}
// Process the URL
let finalUrl;
if (imageUrl.startsWith('gs://')) {
const gcsPath = imageUrl.replace('gs://', '');
const slashIndex = gcsPath.indexOf('/');
if (slashIndex !== -1) {
const bucket = gcsPath.substring(0, slashIndex);
const objectPath = gcsPath.substring(slashIndex + 1);
finalUrl = `https://storage.googleapis.com/${bucket}/${objectPath}`;
} else {
finalUrl = PLACEHOLDER_IMAGE;
}
} else {
finalUrl = imageUrl;
}
// Cache the result and log the current cache size (in debug mode only)
imageUrlCache.set(imageUrl, finalUrl);
if (DEBUG_MODE) {
console.log(`Image cache size: ${imageUrlCache.size()}`);
}
return finalUrl;
}