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:
parent
91c34d120f
commit
157749060e
1 changed files with 11 additions and 3 deletions
|
|
@ -1510,9 +1510,17 @@
|
||||||
|
|
||||||
// Check if items have imageUrl - skip upload step if they're remote URLs (will be downloaded by saveWizard)
|
// 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 itemsWithImages = (config.extractedData.items || []).filter(item => item.imageUrl).length;
|
||||||
const itemsWithRemoteImages = (config.extractedData.items || []).filter(item =>
|
const itemsWithRemoteImages = (config.extractedData.items || []).filter(item => {
|
||||||
item.imageUrl && (item.imageUrl.startsWith('http://') || item.imageUrl.startsWith('https://'))
|
if (!item.imageUrl) return false;
|
||||||
).length;
|
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) {
|
if (itemsWithRemoteImages > 0) {
|
||||||
// Items have remote image URLs - saveWizard will download them, skip upload step
|
// Items have remote image URLs - saveWizard will download them, skip upload step
|
||||||
|
|
|
||||||
Reference in a new issue