fix: normalize pasted image paths and subfolder extraction (Windows-safe, upstream-only)

This commit is contained in:
doubletwisted
2025-08-15 21:45:19 +02:00
parent f91d2d579d
commit 4b513d49c3
2 changed files with 19 additions and 8 deletions
+5 -3
View File
@@ -105,13 +105,15 @@ export function findImageReferences(extension, apiPrompt) {
if (typeof mediaValue === 'string') {
// Clean special suffixes like [input] or [output]
const cleanValue = mediaValue.replace(/\s*\[\w+\]$/, '').trim();
if (imageExtensions.test(cleanValue)) {
images.set(cleanValue, {
// Normalize to forward slashes so subfolder/filename derivation is consistent on Windows
const normalizedValue = cleanValue.replace(/\\/g, '/');
if (imageExtensions.test(normalizedValue)) {
images.set(normalizedValue, {
nodeId,
nodeType: node.class_type,
inputName: 'image' // Keep as 'image' for compatibility
});
extension.log(`Found media reference: ${cleanValue} in node ${nodeId} (${node.class_type})`, "debug");
extension.log(`Found media reference: ${normalizedValue} in node ${nodeId} (${node.class_type})`, "debug");
}
}
}