From b1e29f4273667ba9292c8618ed33c2a1ace0898f Mon Sep 17 00:00:00 2001
From: seonghobae <8172694+seonghobae@users.noreply.github.com>
Date: Fri, 7 Aug 2026 03:48:32 +0000
Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20[UX=20improvement?=
=?UTF-8?q?]=20=EB=A3=A8=ED=8A=B8=20=EB=94=94=EB=A0=89=ED=86=A0=EB=A6=AC?=
=?UTF-8?q?=20=EB=A0=8C=EB=8D=94=EB=A7=81=20=EC=8B=9C=20=EB=B9=88=20?=
=?UTF-8?q?=EC=9D=B4=EB=A6=84=20=ED=8F=B4=EB=B0=B1=20=EC=B2=98=EB=A6=AC=20?=
=?UTF-8?q?=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.jules/palette.md | 4 ++++
src/main/kotlin/html4tree/main.kt | 6 ++++--
src/test/kotlin/html4tree/MainTest.kt | 15 +++++++++++++++
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/.jules/palette.md b/.jules/palette.md
index 7b223901..12c3e316 100644
--- a/.jules/palette.md
+++ b/.jules/palette.md
@@ -52,3 +52,7 @@
## 2024-07-13 - 빈 디렉토리 상태의 접근성(Accessibility) 개선
**Learning:** 정적 파일 서버의 빈 디렉토리 상태는 스크린 리더 사용자에게 컨텐츠 누락으로 오해받을 수 있으며, 시각적으로도 일반 리스트 아이템과 정렬이 맞지 않는 문제가 있었습니다.
**Action:** 빈 상태를 나타내는 요소에 `role="status"`를 추가하여 스크린 리더가 명확하게 인지할 수 있도록 하고, 아이콘과 flex 레이아웃을 통해 다른 리스트 아이템과 일관된 시각적 흐름을 제공하도록 합니다.
+
+## 2026-08-07 - 빈 디렉토리 상태의 접근성(Accessibility) 개선 및 폴백
+**Learning:** 루트 디렉토리나 이름이 빈 디렉토리를 렌더링할 때 `
` 및 `
`이 비어 있으면 스크린 리더 사용자가 현재 위치를 인지하기 어려우며 접근성을 저해합니다.
+**Action:** 디렉토리 이름이 비어 있는 경우(예: 파일 시스템 루트) 항상 '/'와 같은 시각적으로 명확한 기본 폴백 이름을 제공하십시오. 절대 경로를 노출하면 정보 노출(Information Disclosure) 취약점이 발생하므로 피해야 합니다.
diff --git a/src/main/kotlin/html4tree/main.kt b/src/main/kotlin/html4tree/main.kt
index f52a1468..a0364a14 100644
--- a/src/main/kotlin/html4tree/main.kt
+++ b/src/main/kotlin/html4tree/main.kt
@@ -326,6 +326,8 @@ fun process_dir(curr_dir: File, excludeSet: Set? = null, dirFiles: Array
val exclude: Set = excludeSet ?: process_ignore_file(curr_dir)
+ val displayDirName = if (curr_dir.getName().isEmpty()) "/" else curr_dir.getName()
+
val index_top = """
@@ -336,12 +338,12 @@ fun process_dir(curr_dir: File, excludeSet: Set? = null, dirFiles: Array
- ${curr_dir.getName().escapeHtml()}
+ ${displayDirName.escapeHtml()}
-