fix(markdown): decode a percent-encoded link before checking that it exists
Каждый markdown-рендерер процентно кодирует ссылку на файл с пробелами или не-ASCII в имени. Проверка сравнивала закодированную форму с файловой системой и объявляла отсутствующим файл, который лежит на месте: MARKDOWN_LINK_TARGET_MISSING: GitLab%2017.10.0%20%E2%86%92%20Docker%20Migration.md Ложное срабатывание блокировало `validate` на репозитории Infra/Docker. Ссылка декодируется перед резолвом; тест закрепляет и пробел, и то, что настоящая битая ссылка по-прежнему находится. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
8b6c01e942
commit
c607a14f8b
@@ -316,6 +316,15 @@ def test_a_real_broken_link_is_still_reported(tmp_path: Path) -> None:
|
||||
assert codes == ["MARKDOWN_LINK_TARGET_MISSING"]
|
||||
|
||||
|
||||
def test_percent_encoded_link_resolves_to_the_real_file(tmp_path) -> None:
|
||||
"""Renderers percent-encode spaces and non-ASCII; the file is still there."""
|
||||
from stewardship.markdown import check_markdown_file
|
||||
|
||||
(tmp_path / "GitLab 17.10.0 Migration.md").write_text("# M" + chr(10), encoding="utf-8")
|
||||
link = "See [m](GitLab%2017.10.0%20Migration.md)."
|
||||
(tmp_path / "CLAUDE.md").write_text("# Doc" + chr(10) * 2 + link + chr(10), encoding="utf-8")
|
||||
assert check_markdown_file(tmp_path, "CLAUDE.md") == []
|
||||
|
||||
# --- path confinement: "." is a whole path, never a segment ------------------
|
||||
|
||||
def test_repository_root_is_a_legal_content_root_path() -> None:
|
||||
|
||||
Reference in New Issue
Block a user