Skip to content
4 changes: 4 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,7 @@
## 2024-07-13 - ๋นˆ ๋””๋ ‰ํ† ๋ฆฌ ์ƒํƒœ์˜ ์ ‘๊ทผ์„ฑ(Accessibility) ๊ฐœ์„ 
**Learning:** ์ •์  ํŒŒ์ผ ์„œ๋ฒ„์˜ ๋นˆ ๋””๋ ‰ํ† ๋ฆฌ ์ƒํƒœ๋Š” ์Šคํฌ๋ฆฐ ๋ฆฌ๋” ์‚ฌ์šฉ์ž์—๊ฒŒ ์ปจํ…์ธ  ๋ˆ„๋ฝ์œผ๋กœ ์˜คํ•ด๋ฐ›์„ ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์‹œ๊ฐ์ ์œผ๋กœ๋„ ์ผ๋ฐ˜ ๋ฆฌ์ŠคํŠธ ์•„์ดํ…œ๊ณผ ์ •๋ ฌ์ด ๋งž์ง€ ์•Š๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
**Action:** ๋นˆ ์ƒํƒœ๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ์š”์†Œ์— `role="status"`๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ ์Šคํฌ๋ฆฐ ๋ฆฌ๋”๊ฐ€ ๋ช…ํ™•ํ•˜๊ฒŒ ์ธ์ง€ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๊ณ , ์•„์ด์ฝ˜๊ณผ flex ๋ ˆ์ด์•„์›ƒ์„ ํ†ตํ•ด ๋‹ค๋ฅธ ๋ฆฌ์ŠคํŠธ ์•„์ดํ…œ๊ณผ ์ผ๊ด€๋œ ์‹œ๊ฐ์  ํ๋ฆ„์„ ์ œ๊ณตํ•˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.

## 2026-08-07 - ๋นˆ ๋””๋ ‰ํ† ๋ฆฌ ์ƒํƒœ์˜ ์ ‘๊ทผ์„ฑ(Accessibility) ๊ฐœ์„  ๋ฐ ํด๋ฐฑ
**Learning:** ๋ฃจํŠธ ๋””๋ ‰ํ† ๋ฆฌ๋‚˜ ์ด๋ฆ„์ด ๋นˆ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ๋ Œ๋”๋งํ•  ๋•Œ `<title>` ๋ฐ `<h1>`์ด ๋น„์–ด ์žˆ์œผ๋ฉด ์Šคํฌ๋ฆฐ ๋ฆฌ๋” ์‚ฌ์šฉ์ž๊ฐ€ ํ˜„์žฌ ์œ„์น˜๋ฅผ ์ธ์ง€ํ•˜๊ธฐ ์–ด๋ ค์šฐ๋ฉฐ ์ ‘๊ทผ์„ฑ์„ ์ €ํ•ดํ•ฉ๋‹ˆ๋‹ค.
**Action:** ๋””๋ ‰ํ† ๋ฆฌ ์ด๋ฆ„์ด ๋น„์–ด ์žˆ๋Š” ๊ฒฝ์šฐ(์˜ˆ: ํŒŒ์ผ ์‹œ์Šคํ…œ ๋ฃจํŠธ) ํ•ญ์ƒ '/'์™€ ๊ฐ™์€ ์‹œ๊ฐ์ ์œผ๋กœ ๋ช…ํ™•ํ•œ ๊ธฐ๋ณธ ํด๋ฐฑ ์ด๋ฆ„์„ ์ œ๊ณตํ•˜์‹ญ์‹œ์˜ค. ์ ˆ๋Œ€ ๊ฒฝ๋กœ๋ฅผ ๋…ธ์ถœํ•˜๋ฉด ์ •๋ณด ๋…ธ์ถœ(Information Disclosure) ์ทจ์•ฝ์ ์ด ๋ฐœ์ƒํ•˜๋ฏ€๋กœ ํ”ผํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
6 changes: 4 additions & 2 deletions src/main/kotlin/html4tree/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ fun process_dir(curr_dir: File, excludeSet: Set<String>? = null, dirFiles: Array

val exclude: Set<String> = excludeSet ?: process_ignore_file(curr_dir)

val displayDirName = if (curr_dir.getName().isEmpty()) "/" else curr_dir.getName()

val index_top = """<!doctype html>
<html lang="ko">
<head>
Expand All @@ -336,12 +338,12 @@ fun process_dir(curr_dir: File, excludeSet: Set<String>? = null, dirFiles: Array
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src '${STYLE_HASH}'; base-uri 'none'; form-action 'none';">
<!-- ๋ณด์•ˆ ํ–ฅ์ƒ: ๋ฆฌํผ๋Ÿฌ๋ฅผ ํ†ตํ•œ ๋””๋ ‰ํ† ๋ฆฌ ๊ฒฝ๋กœ ๋…ธ์ถœ ๋ฐฉ์ง€ -->
<meta name="referrer" content="no-referrer">
<title>${curr_dir.getName().escapeHtml()}</title>
<title>${displayDirName.escapeHtml()}</title>
<style>${CSS_CONTENT}</style>
</head>
<body>
<main>
<h1>${curr_dir.getName().escapeHtml()}</h1>
<h1>${displayDirName.escapeHtml()}</h1>
<nav aria-label="๋””๋ ‰ํ† ๋ฆฌ ๋ชฉ๋ก">
<ul role="list">
<li><a class="dir-link" href="./.." aria-label="์ƒ์œ„ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™" title="์ƒ์œ„ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™"><span class="icon" aria-hidden="true">&#x21B0;</span> <span>..</span></a></li>
Expand Down
15 changes: 15 additions & 0 deletions src/test/kotlin/html4tree/MainTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,21 @@ class MainTest {
process_dir(tempDir)
}

@Test
fun testProcessDirEmptyNameFallback() {
val rootDir = File(tempDir, "rootMockDir")
rootDir.mkdir()
val mockRootFile = object : File(tempDir, "rootMockDir") {
override fun getName() = ""
}
process_dir(mockRootFile)
val indexFile = File(rootDir, "index.html")
assertTrue(indexFile.exists())
val htmlContent = indexFile.readText()
assertTrue(htmlContent.contains("<title>/</title>"))
assertTrue(htmlContent.contains("<h1>/</h1>"))
}

@Test(expected = IllegalArgumentException::class)
fun testGoBlankDir() {
go(" ", -1)
Expand Down
Loading