Add debug logging and fix protocol-relative URL check

Log sample imageUrls to console to debug why upload step is shown.
Also handle protocol-relative URLs (//domain.com/...).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-02-13 09:02:32 -08:00
parent 91c34d120f
commit 157749060e

View file

@ -1510,9 +1510,17 @@
// Check if items have imageUrl - skip upload step if they're remote URLs (will be downloaded by saveWizard)
const itemsWithImages = (config.extractedData.items || []).filter(item => item.imageUrl).length;
const itemsWithRemoteImages = (config.extractedData.items || []).filter(item =>
item.imageUrl && (item.imageUrl.startsWith('http://') || item.imageUrl.startsWith('https://'))
).length;
const itemsWithRemoteImages = (config.extractedData.items || []).filter(item => {
if (!item.imageUrl) return false;
const url = item.imageUrl;
// Remote: http://, https://, or protocol-relative //
return url.startsWith('http://') || url.startsWith('https://') || url.startsWith('//');
}).length;
// Debug: log sample imageUrls
const sampleItems = (config.extractedData.items || []).filter(item => item.imageUrl).slice(0, 3);
console.log('Items with images:', itemsWithImages, 'Remote:', itemsWithRemoteImages);
console.log('Sample imageUrls:', sampleItems.map(i => i.imageUrl));
if (itemsWithRemoteImages > 0) {
// Items have remote image URLs - saveWizard will download them, skip upload step