Skip to content

Commit 109c352

Browse files
committed
BUG: Fix docs build broken link check bug
1 parent dcda33e commit 109c352

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

doc/build.sh

+9-3
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ grep -PR '<a .*?href=' |
7878
cut -d'#' -f1 |
7979
sort -u -t$'\t' -k 2 |
8080
sort -u |
81+
tee >(cat 1>&2) |
8182
python -c '
8283
import sys
8384
from urllib.parse import urljoin
@@ -90,9 +91,14 @@ for line in sys.stdin.readlines():
9091
grep -v $'\t''$' |
9192
while read -r line; do
9293
while IFS=$'\t' read -r file url; do
93-
url=$(python -c 'import html, sys; print(html.unescape(sys.argv[-1]))' "$url")
94-
[ -f "$url" ] ||
95-
curl --silent --fail --retry 5 --retry-delay 5 --user-agent 'Mozilla/5.0 Firefox 61' "$url" >/dev/null 2>&1 ||
94+
target_file="$(python -c '
95+
import html, sys # fixes &amp;
96+
from urllib.parse import unquote # fixes %20
97+
print(html.unescape(unquote(sys.argv[-1])))' "$url")"
98+
if [ -f "$target_file" ]; then continue; fi
99+
100+
url="${url// /%20}"
101+
curl --silent --fail --retry 5 --retry-delay 5 --user-agent 'Mozilla/5.0 Firefox 101' "$url" >/dev/null 2>&1 ||
96102
die "broken link in $file: $url"
97103
done
98104
done

0 commit comments

Comments
 (0)