From 0430c97a25935dccc12e5521184c55ea6860d1a6 Mon Sep 17 00:00:00 2001 From: CyC2018 Date: Fri, 6 Nov 2026 07:10:29 +0800 Subject: [PATCH] Update check.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 入口页中指向目录地址(/notes/)的链接按其中的 index.html 检查。 --- website/builder/check.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website/builder/check.py b/website/builder/check.py index a272a679..0e858f3a 100644 --- a/website/builder/check.py +++ b/website/builder/check.py @@ -37,7 +37,9 @@ def check(source, output): if name not in files and name + '.md' not in files and name.rstrip('/') + '/index.html' not in files: errors.append('缺失引用:' + name) for name in re.findall(r'(?:src|href)="(/[^"#]+)"', (output / 'index.html').read_text()): - if name.split('?')[0].lstrip('/') not in files: + path = name.split('?')[0].lstrip('/') + # 目录地址(/notes/)由其中的 index.html 提供 + if path not in files and not (path.endswith('/') and path + 'index.html' in files): errors.append('缺失页面资源:' + name) forbidden = [name for name in files if set(Path(name).parts) & { '.git', '.cache', 'node_modules', 'builder', 'templates', 'upstream', 'remote',