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:** 루트 디렉토리나 이름이 빈 디렉토리를 렌더링할 때 `` 및 `<h1>`이 비어 있으면 스크린 리더 사용자가 현재 위치를 인지하기 어려우며 접근성을 저해합니다. +**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<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> @@ -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()} + ${displayDirName.escapeHtml()}
-

${curr_dir.getName().escapeHtml()}

+

${displayDirName.escapeHtml()}