Update check.py

入口页中指向目录地址(/notes/)的链接按其中的 index.html 检查。
This commit is contained in:
CyC2018
2026-11-06 07:10:29 +08:00
parent d9716ffd8c
commit 0430c97a25
+3 -1
View File
@@ -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',