Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-09 - 루트 디렉토리 빈 이름 λŒ€μ²΄(Fallback) 처리
**Learning:** 파일 μ‹œμŠ€ν…œ 루트(예: `/` λ˜λŠ” `C:\`)의 경우 `File.getName()`이 빈 λ¬Έμžμ—΄μ„ λ°˜ν™˜ν•˜μ—¬, μƒμ„±λœ HTMLμ—μ„œ 빈 `<title>`κ³Ό `<h1>` νƒœκ·Έκ°€ λ§Œλ“€μ–΄μ§‘λ‹ˆλ‹€. μ΄λŠ” ν™”λ©΄ νŒλ…κΈ° μ‚¬μš©μžμ—κ²Œ νŽ˜μ΄μ§€ 제λͺ©μ΄ μ œκ³΅λ˜μ§€ μ•ŠμœΌλ―€λ‘œ 접근성을 μ‹¬κ°ν•˜κ²Œ μ €ν•˜μ‹œν‚΅λ‹ˆλ‹€.
**Action:** 디렉토리 이름이 λΉ„μ–΄ μžˆλŠ” 경우 μ‹œκ°μ /μ ‘κ·Όμ„± λͺ©μ μœΌλ‘œ 포괄적인 λŒ€μ²΄ ν…μŠ€νŠΈ(예: `/`)λ₯Ό μ œκ³΅ν•˜μ‹­μ‹œμ˜€. 정보 유좜(Information Disclosure) 취약점을 λ°©μ§€ν•˜κΈ° μœ„ν•΄ μ„œλ²„μ˜ μ ˆλŒ€ 경둜(`absolutePath`)λ₯Ό μ‚¬μš©μžμ—κ²Œ λ…ΈμΆœν•˜λŠ” λŒ€μ²΄κ°’μ€ μ ˆλŒ€ μ‚¬μš©ν•˜μ§€ λ§ˆμ‹­μ‹œμ˜€.
6 changes: 4 additions & 2 deletions src/main/kotlin/html4tree/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ fun process_dir(curr_dir: File, excludeSet: Set<String>? = null, dirFiles: Array

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

val dirName = if (curr_dir.name.isEmpty()) "/" else curr_dir.name

val index_top = """<!doctype html>
<html lang="ko">
<head>
Expand All @@ -352,12 +354,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>${dirName.escapeHtml()}</title>
<style>${CSS_CONTENT}</style>
</head>
<body>
<main>
<h1>${curr_dir.getName().escapeHtml()}</h1>
<h1>${dirName.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
12 changes: 12 additions & 0 deletions src/test/kotlin/html4tree/MainTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,18 @@ class MainTest {
assertTrue(excluded.contains("index.html"))
}

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

@Test
fun testProcessDirItEqualsCurrDir() {
File(tempDir, "tempDir").mkdir()
Expand Down
Loading