[fix] Add bounds checking for clipspace indices to prevent paste errors (#4849)

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Christian Byrne
2025-08-10 15:45:28 -07:00
committed by GitHub
parent 109542dca3
commit c4912dcd54
10 changed files with 42 additions and 29 deletions

View File

@@ -3976,13 +3976,19 @@ class UIManager {
const mainImageFilename =
new URL(mainImageUrl).searchParams.get('filename') ?? undefined
const combinedImageFilename =
let combinedImageFilename: string | null | undefined
if (
ComfyApp.clipspace?.combinedIndex !== undefined &&
ComfyApp.clipspace?.imgs?.[ComfyApp.clipspace.combinedIndex]?.src
? new URL(
ComfyApp.clipspace.imgs[ComfyApp.clipspace.combinedIndex].src
).searchParams.get('filename')
: undefined
ComfyApp.clipspace?.imgs &&
ComfyApp.clipspace.combinedIndex < ComfyApp.clipspace.imgs.length &&
ComfyApp.clipspace.imgs[ComfyApp.clipspace.combinedIndex]?.src
) {
combinedImageFilename = new URL(
ComfyApp.clipspace.imgs[ComfyApp.clipspace.combinedIndex].src
).searchParams.get('filename')
} else {
combinedImageFilename = undefined
}
const imageLayerFilenames =
mainImageFilename !== undefined

View File

@@ -243,7 +243,7 @@
"label": "Alternar panel inferior de controles de vista"
},
"Workspace_ToggleBottomPanel_Shortcuts": {
"label": "Mostrar diálogo de combinaciones de teclas"
"label": "Mostrar diálogo de atajos de teclado"
},
"Workspace_ToggleFocusMode": {
"label": "Alternar Modo de Enfoque"

View File

@@ -1157,7 +1157,7 @@
"node": "Nœud",
"panelControls": "Contrôles du panneau",
"queue": "File dattente",
"view": "Affichage",
"view": "Vue",
"workflow": "Flux de travail"
},
"viewControls": "Contrôles daffichage"

View File

@@ -1151,7 +1151,7 @@
"shortcuts": {
"essentials": "基本",
"keyboardShortcuts": "キーボードショートカット",
"manageShortcuts": "ショートカット管理",
"manageShortcuts": "ショートカット管理",
"noKeybinding": "キー割り当てなし",
"subcategories": {
"node": "ノード",

View File

@@ -808,7 +808,7 @@
"Restart": "재시작",
"Save": "저장",
"Save As": "다른 이름으로 저장",
"Show Keybindings Dialog": "단축키 대화상자 표시",
"Show Keybindings Dialog": "키 바인딩 대화상자 표시",
"Show Settings Dialog": "설정 대화상자 표시",
"Sign Out": "로그아웃",
"Toggle Bottom Panel": "하단 패널 전환",
@@ -1149,7 +1149,7 @@
"Workflow": "워크플로"
},
"shortcuts": {
"essentials": "기본",
"essentials": "필수",
"keyboardShortcuts": "키보드 단축키",
"manageShortcuts": "단축키 관리",
"noKeybinding": "단축키 없음",

View File

@@ -240,7 +240,7 @@
"label": "Показать/скрыть основную нижнюю панель"
},
"Workspace_ToggleBottomPanelTab_shortcuts-view-controls": {
"label": "Показать/скрыть нижнюю панель управления просмотром"
"label": "Показать или скрыть нижнюю панель управления просмотром"
},
"Workspace_ToggleBottomPanel_Shortcuts": {
"label": "Показать диалог клавиш"

View File

@@ -1152,7 +1152,7 @@
"essentials": "Основные",
"keyboardShortcuts": "Горячие клавиши",
"manageShortcuts": "Управление горячими клавишами",
"noKeybinding": "Нет привязки клавиши",
"noKeybinding": "Нет сочетания клавиш",
"subcategories": {
"node": "Узел",
"panelControls": "Управление панелью",

View File

@@ -72,7 +72,7 @@
"label": "锁定视图"
},
"Comfy_Canvas_ToggleMinimap": {
"label": "布切小地"
"label": "布切小地"
},
"Comfy_Canvas_ToggleSelectedNodes_Bypass": {
"label": "忽略/取消忽略选中节点"
@@ -237,13 +237,13 @@
"label": "切换日志底部面板"
},
"Workspace_ToggleBottomPanelTab_shortcuts-essentials": {
"label": "切基本下方面板"
"label": "切基本下方面板"
},
"Workspace_ToggleBottomPanelTab_shortcuts-view-controls": {
"label": "切换检视控制底部面板"
"label": "切換檢視控制底部面板"
},
"Workspace_ToggleBottomPanel_Shortcuts": {
"label": "示快捷键对话框"
"label": "示快捷鍵對話框"
},
"Workspace_ToggleFocusMode": {
"label": "切换焦点模式"

View File

@@ -410,7 +410,7 @@
"resetView": "重置视图",
"selectMode": "选择模式",
"toggleLinkVisibility": "切换连线可见性",
"toggleMinimap": "切小地",
"toggleMinimap": "切小地",
"zoomIn": "放大",
"zoomOut": "缩小"
},
@@ -746,7 +746,7 @@
"Bypass/Unbypass Selected Nodes": "忽略/取消忽略选定节点",
"Canvas Toggle Link Visibility": "切换连线可见性",
"Canvas Toggle Lock": "切换视图锁定",
"Canvas Toggle Minimap": "布切小地",
"Canvas Toggle Minimap": "布切小地",
"Check for Updates": "检查更新",
"Clear Pending Tasks": "清除待处理任务",
"Clear Workflow": "清除工作流",
@@ -808,21 +808,21 @@
"Restart": "重启",
"Save": "保存",
"Save As": "另存为",
"Show Keybindings Dialog": "示快捷键对话框",
"Show Keybindings Dialog": "示快捷鍵對話框",
"Show Settings Dialog": "显示设置对话框",
"Sign Out": "退出登录",
"Toggle Bottom Panel": "切换底部面板",
"Toggle Essential Bottom Panel": "切基本下方面板",
"Toggle Essential Bottom Panel": "切基本下方面板",
"Toggle Focus Mode": "切换专注模式",
"Toggle Logs Bottom Panel": "切换日志底部面板",
"Toggle Model Library Sidebar": "切模型库侧边栏",
"Toggle Node Library Sidebar": "切换节点库侧边栏",
"Toggle Queue Sidebar": "切换队列侧边栏",
"Toggle Model Library Sidebar": "切模型庫側邊欄",
"Toggle Node Library Sidebar": "切換節點庫側邊欄",
"Toggle Queue Sidebar": "切換佇列側邊欄",
"Toggle Search Box": "切换搜索框",
"Toggle Terminal Bottom Panel": "切换终端底部面板",
"Toggle Theme (Dark/Light)": "切换主题(暗/亮)",
"Toggle View Controls Bottom Panel": "切换检视控制下方面板",
"Toggle Workflows Sidebar": "切工作流程侧边栏",
"Toggle View Controls Bottom Panel": "切換檢視控制下方面板",
"Toggle Workflows Sidebar": "切工作流程側邊欄",
"Toggle the Custom Nodes Manager": "切换自定义节点管理器",
"Toggle the Custom Nodes Manager Progress Bar": "切换自定义节点管理器进度条",
"Undo": "撤销",
@@ -1149,7 +1149,7 @@
"Workflow": "工作流"
},
"shortcuts": {
"essentials": "基本",
"essentials": "基本功能",
"keyboardShortcuts": "鍵盤快捷鍵",
"manageShortcuts": "管理快捷鍵",
"noKeybinding": "無快捷鍵",

View File

@@ -385,8 +385,15 @@ export class ComfyApp {
static pasteFromClipspace(node: LGraphNode) {
if (ComfyApp.clipspace) {
// image paste
const combinedImgSrc =
ComfyApp.clipspace.imgs?.[ComfyApp.clipspace.combinedIndex].src
let combinedImgSrc: string | undefined
if (
ComfyApp.clipspace.combinedIndex !== undefined &&
ComfyApp.clipspace.imgs &&
ComfyApp.clipspace.combinedIndex < ComfyApp.clipspace.imgs.length
) {
combinedImgSrc =
ComfyApp.clipspace.imgs[ComfyApp.clipspace.combinedIndex].src
}
if (ComfyApp.clipspace.imgs && node.imgs) {
if (node.images && ComfyApp.clipspace.images) {
if (ComfyApp.clipspace['img_paste_mode'] == 'selected') {