From c5d4b3f046dcc32a8b9927c6d52aea22965048af Mon Sep 17 00:00:00 2001 From: umsangdon Date: Sat, 8 Aug 2026 14:17:48 +0900 Subject: [PATCH] =?UTF-8?q?fix(B03):=20=ED=8C=8C=EC=9D=BC=20=EC=88=98=20?= =?UTF-8?q?=EC=B4=88=EA=B3=BC=20=EC=98=A4=ED=83=90=20-=20=EA=B3=A0?= =?UTF-8?q?=EB=A5=B8=20=ED=8C=8C=EC=9D=BC=20=EC=88=98=20=EB=8C=80=EC=8B=A0?= =?UTF-8?q?=20=EC=B5=9C=EC=A2=85=20=EC=A0=90=EC=9C=A0=20=EC=8A=AC=EB=A1=AF?= =?UTF-8?q?=20=EC=88=98=EB=A1=9C=20=ED=8C=90=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- B03_FileInput/B03_FileInput_UI_Page.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/B03_FileInput/B03_FileInput_UI_Page.ts b/B03_FileInput/B03_FileInput_UI_Page.ts index 1e4966df..60d6b3b2 100644 --- a/B03_FileInput/B03_FileInput_UI_Page.ts +++ b/B03_FileInput/B03_FileInput_UI_Page.ts @@ -268,10 +268,19 @@ export async function renderB03FileInput(root: HTMLElement): Promise { function onFileSelected(files: readonly File[], targetSlot?: FileSlot): void { if (files.length === 0) return; - // 이미 고른 슬롯을 다시 고르는 것은 "교체"라 총 개수가 늘지 않는다 — 그 슬롯을 빼고 센다. - // (빼지 않으면 5개를 다 고른 뒤 하나만 바꾸려 할 때 개수 초과로 막힌다.) - const occupied = selectedStates().filter((state) => state.slot !== targetSlot).length; - if (occupied + files.length > UPLOAD_MAX_FILES) { + // 개수는 "고른 파일 수"가 아니라 **최종적으로 차는 슬롯 수**로 센다. + // 같은 슬롯을 다시 고르는 것은 교체라 개수가 늘지 않는다 — 더하기로 세면 5개를 고른 + // 뒤 파일 선택 영역으로 하나만 바꾸려 해도 초과로 막힌다(2026-08-08). + const occupied = new Set(selectedStates().map((state) => state.slot)); + for (const file of files) { + const extension = getExtension(file.name); + const slot = + targetSlot ?? + Array.from(slots.values()).find((candidate) => candidate.extensions.includes(extension)) + ?.slot; + if (slot) occupied.add(slot); + } + if (occupied.size > UPLOAD_MAX_FILES) { pageError.textContent = L("B03_File_Error_Count"); return; }