From 1677d92dd503ed7c973308e653d41a3b12d347ef Mon Sep 17 00:00:00 2001
From: seonghobae <8172694+seonghobae@users.noreply.github.com>
Date: Tue, 14 Jul 2026 03:49:46 +0000
Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20=EB=A3=A8?=
=?UTF-8?q?=ED=8A=B8=20=EB=94=94=EB=A0=89=ED=86=A0=EB=A6=AC=EC=9D=98=20?=
=?UTF-8?q?=EB=B9=88=20=ED=83=80=EC=9D=B4=ED=8B=80=20=EB=B0=8F=20=ED=97=A4?=
=?UTF-8?q?=EB=94=A9=20=EC=A0=91=EA=B7=BC=EC=84=B1=20=EA=B0=9C=EC=84=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
루트 디렉토리(`/`)를 크롤링할 때 `File.getName()`이 빈 문자열을 반환하여
HTML의 `
`과 ``이 비어 있는 문제가 있었습니다.
이를 절대 경로를 대신 표시하도록 수정하여 UX와 접근성을 개선했습니다.
---
.jules/palette.md | 3 +++
src/main/kotlin/html4tree/main.kt | 4 ++--
src/test/kotlin/html4tree/MainTest.kt | 12 ++++++++++++
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/.jules/palette.md b/.jules/palette.md
index 9a12c9d..db992b1 100644
--- a/.jules/palette.md
+++ b/.jules/palette.md
@@ -48,3 +48,6 @@
## 2024-08-01 - 네이티브 브라우저 UI의 다크 모드 지원 강제
**학습:** CSS 미디어 쿼리(`@media (prefers-color-scheme: dark)`)를 통해 다크 모드를 지원하더라도, 브라우저의 네이티브 UI 요소(스크롤바, 기본 폼 컨트롤, 기본 백그라운드 등)는 테마 변경을 인식하지 못해 어두운 테마 환경에서 밝은 스크롤바가 표시되는 등 시각적 불일치를 초래합니다.
**조치:** 항상 HTML 문서의 `` 영역에 ` ` 메타 태그를 명시적으로 추가하여 브라우저 수준에서 사용자의 시스템 테마(다크 모드 등)를 완전히 상속받아 일관성 있는 네이티브 UI를 렌더링하도록 보장하십시오.
+## 2026-07-14 - Root Directory Empty Title Fix
+**Learning:** In Java/Kotlin `java.io.File`, `getName()` returns an empty string for the filesystem root directory (e.g., `/`). When generating HTML listings, this results in empty `` and `` tags, which causes a significant accessibility and UX failure.
+**Action:** When using directory names for UI elements or semantic attributes, always verify if the name is empty and provide a clear, descriptive fallback (like `absolutePath`) for root paths.
diff --git a/src/main/kotlin/html4tree/main.kt b/src/main/kotlin/html4tree/main.kt
index b455862..19824a5 100644
--- a/src/main/kotlin/html4tree/main.kt
+++ b/src/main/kotlin/html4tree/main.kt
@@ -327,12 +327,12 @@ ${cssContent}
- ${curr_dir.getName().escapeHtml()}
+ ${if (curr_dir.name.isEmpty()) curr_dir.absolutePath.escapeHtml() else curr_dir.name.escapeHtml()}
${css}
- ${curr_dir.getName().escapeHtml()}
+ ${if (curr_dir.name.isEmpty()) curr_dir.absolutePath.escapeHtml() else curr_dir.name.escapeHtml()}
↰ ..
diff --git a/src/test/kotlin/html4tree/MainTest.kt b/src/test/kotlin/html4tree/MainTest.kt
index 1349471..506d728 100644
--- a/src/test/kotlin/html4tree/MainTest.kt
+++ b/src/test/kotlin/html4tree/MainTest.kt
@@ -414,6 +414,18 @@ class MainTest {
}
}
+ @Test
+ fun testRootDirectoryUXFallback() {
+ val mockRoot = object : java.io.File(tempDir.absolutePath) {
+ override fun getName(): String = ""
+ }
+ process_dir(mockRoot)
+ val indexFile = java.io.File(tempDir, "index.html")
+ val htmlContent = indexFile.readText()
+ assertTrue(htmlContent.contains("${tempDir.absolutePath.escapeHtml()} "))
+ assertTrue(htmlContent.contains("${tempDir.absolutePath.escapeHtml()} "))
+ }
+
@Test
fun testGoWithMaxLevel() {
val subdir = File(tempDir, "subdir")
From 4c98b6652f1f5efef57ee8fb748d494280898ffa Mon Sep 17 00:00:00 2001
From: seonghobae <8172694+seonghobae@users.noreply.github.com>
Date: Tue, 14 Jul 2026 04:09:19 +0000
Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20=EB=A3=A8?=
=?UTF-8?q?=ED=8A=B8=20=EB=94=94=EB=A0=89=ED=86=A0=EB=A6=AC=EC=9D=98=20?=
=?UTF-8?q?=EB=B9=88=20=ED=83=80=EC=9D=B4=ED=8B=80=20=EB=B0=8F=20=ED=97=A4?=
=?UTF-8?q?=EB=94=A9=20=EC=A0=91=EA=B7=BC=EC=84=B1=20=EA=B0=9C=EC=84=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
루트 디렉토리(`/`)를 크롤링할 때 `File.getName()`이 빈 문자열을 반환하여
HTML의 ``과 ``이 비어 있는 문제가 있었습니다.
이를 절대 경로를 대신 표시하도록 수정하여 UX와 접근성을 개선했습니다.
From 5e6c8274bedd7f9f4201bdcd10a51e426a2995fa Mon Sep 17 00:00:00 2001
From: seonghobae <8172694+seonghobae@users.noreply.github.com>
Date: Tue, 14 Jul 2026 04:42:20 +0000
Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20=EB=A3=A8?=
=?UTF-8?q?=ED=8A=B8=20=EB=94=94=EB=A0=89=ED=86=A0=EB=A6=AC=EC=9D=98=20?=
=?UTF-8?q?=EB=B9=88=20=ED=83=80=EC=9D=B4=ED=8B=80=20=EB=B0=8F=20=ED=97=A4?=
=?UTF-8?q?=EB=94=A9=20=EC=A0=91=EA=B7=BC=EC=84=B1=20=EA=B0=9C=EC=84=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
루트 디렉토리(`/`)를 크롤링할 때 `File.getName()`이 빈 문자열을 반환하여
HTML의 ``과 ``이 비어 있는 문제가 있었습니다.
이를 절대 경로 대신 루트를 명시하는 `/`로 대체하여 표시하도록 수정하여 UX와 접근성을 개선했습니다.
---
src/main/kotlin/html4tree/main.kt | 4 ++--
src/test/kotlin/html4tree/MainTest.kt | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/kotlin/html4tree/main.kt b/src/main/kotlin/html4tree/main.kt
index 19824a5..a958eb3 100644
--- a/src/main/kotlin/html4tree/main.kt
+++ b/src/main/kotlin/html4tree/main.kt
@@ -327,12 +327,12 @@ ${cssContent}
- ${if (curr_dir.name.isEmpty()) curr_dir.absolutePath.escapeHtml() else curr_dir.name.escapeHtml()}
+ ${if (curr_dir.name.isEmpty()) "/" else curr_dir.name.escapeHtml()}
${css}
- ${if (curr_dir.name.isEmpty()) curr_dir.absolutePath.escapeHtml() else curr_dir.name.escapeHtml()}
+ ${if (curr_dir.name.isEmpty()) "/" else curr_dir.name.escapeHtml()}
↰ ..
diff --git a/src/test/kotlin/html4tree/MainTest.kt b/src/test/kotlin/html4tree/MainTest.kt
index 506d728..41562fb 100644
--- a/src/test/kotlin/html4tree/MainTest.kt
+++ b/src/test/kotlin/html4tree/MainTest.kt
@@ -422,8 +422,8 @@ class MainTest {
process_dir(mockRoot)
val indexFile = java.io.File(tempDir, "index.html")
val htmlContent = indexFile.readText()
- assertTrue(htmlContent.contains("${tempDir.absolutePath.escapeHtml()} "))
- assertTrue(htmlContent.contains("${tempDir.absolutePath.escapeHtml()} "))
+ assertTrue(htmlContent.contains("/ "))
+ assertTrue(htmlContent.contains("/ "))
}
@Test
From 0d76b058b0700c81d136184b6dd17fadffbf08f8 Mon Sep 17 00:00:00 2001
From: seonghobae <8172694+seonghobae@users.noreply.github.com>
Date: Tue, 14 Jul 2026 05:01:37 +0000
Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20=EB=A3=A8?=
=?UTF-8?q?=ED=8A=B8=20=EB=94=94=EB=A0=89=ED=86=A0=EB=A6=AC=EC=9D=98=20?=
=?UTF-8?q?=EB=B9=88=20=ED=83=80=EC=9D=B4=ED=8B=80=20=EB=B0=8F=20=ED=97=A4?=
=?UTF-8?q?=EB=94=A9=20=EC=A0=91=EA=B7=BC=EC=84=B1=20=EA=B0=9C=EC=84=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
루트 디렉토리(`/`)를 크롤링할 때 `File.getName()`이 빈 문자열을 반환하여
HTML의 ``과 ``이 비어 있는 문제가 있었습니다.
이 경우 명시적으로 "루트 디렉토리"라는 문구를 출력하도록 폴백 로직을 추가하여 UX와 스크린 리더 접근성을 개선했습니다.
---
src/main/kotlin/html4tree/main.kt | 4 ++--
src/test/kotlin/html4tree/MainTest.kt | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/kotlin/html4tree/main.kt b/src/main/kotlin/html4tree/main.kt
index a958eb3..cc9a4f9 100644
--- a/src/main/kotlin/html4tree/main.kt
+++ b/src/main/kotlin/html4tree/main.kt
@@ -327,12 +327,12 @@ ${cssContent}
- ${if (curr_dir.name.isEmpty()) "/" else curr_dir.name.escapeHtml()}
+ ${if (curr_dir.name.isEmpty()) "루트 디렉토리" else curr_dir.name.escapeHtml()}
${css}
- ${if (curr_dir.name.isEmpty()) "/" else curr_dir.name.escapeHtml()}
+ ${if (curr_dir.name.isEmpty()) "루트 디렉토리" else curr_dir.name.escapeHtml()}
↰ ..
diff --git a/src/test/kotlin/html4tree/MainTest.kt b/src/test/kotlin/html4tree/MainTest.kt
index 41562fb..7a8b8b3 100644
--- a/src/test/kotlin/html4tree/MainTest.kt
+++ b/src/test/kotlin/html4tree/MainTest.kt
@@ -422,8 +422,8 @@ class MainTest {
process_dir(mockRoot)
val indexFile = java.io.File(tempDir, "index.html")
val htmlContent = indexFile.readText()
- assertTrue(htmlContent.contains("/ "))
- assertTrue(htmlContent.contains("/ "))
+ assertTrue(htmlContent.contains("루트 디렉토리 "))
+ assertTrue(htmlContent.contains("루트 디렉토리 "))
}
@Test