diff --git a/.gitea/workflows/test-skins.yml b/.gitea/workflows/test-skins.yml index 6b0c6bba..2c94af6f 100644 --- a/.gitea/workflows/test-skins.yml +++ b/.gitea/workflows/test-skins.yml @@ -23,17 +23,7 @@ jobs: ERRORS=() ############################################################ - # Remove all NUL/control characters BEFORE any decoding - ############################################################ - sanitize_url() { - printf '%s' "$1" \ - | tr -d '\000' \ - | tr -d '\r' \ - | sed 's/[[:cntrl:]]//g' - } - - ############################################################ - # Safe unicode URL decode (no null bytes) + # Safe unicode URL decode (never produces NULL bytes) ############################################################ urldecode() { local url="$1" @@ -42,7 +32,7 @@ jobs: } ############################################################ - # Detect Gitea "soft 404" even when status=200 OK + # Detect Gitea "soft 404" even when HTTP=200 OK ############################################################ check_http() { local url="$1" @@ -50,21 +40,19 @@ jobs: local status body - # Try HEAD first status=$(curl -Is --max-time 10 "$url" | head -n1 | awk '{print $2}') if [[ "$status" =~ ^2|3 ]]; then body=$(curl -Ls --max-time 10 "$url") - if echo "$body" | grep -qiE "404 Not Found|Path .* doesn't exist|File not found|does not exist|Not Found"; then + if echo "$body" | grep -qiE "404 Not Found|doesn't exist|File not found|Not Found"; then return 1 fi return 0 fi - # Try GET fallback status=$(curl -Is --max-time 10 -X GET "$url" | head -n1 | awk '{print $2}') if [[ "$status" =~ ^2|3 ]]; then body=$(curl -Ls --max-time 10 "$url") - if echo "$body" | grep -qiE "404 Not Found|Path .* doesn't exist|File not found|does not exist|Not Found"; then + if echo "$body" | grep -qiE "404 Not Found|doesn't exist|File not found|Not Found"; then return 1 fi return 0 @@ -74,7 +62,7 @@ jobs: } ############################################################ - # Local file existence check + # Local file check ############################################################ check_local() { local path="$1" @@ -88,34 +76,32 @@ jobs: } ############################################################ - # Extract URLs from Markdown + HTML + # Extract links from markdown + HTML ############################################################ extract_links() { local f="$1" - # Markdown links grep -oE '\[[^]]*\]\([^)]*\)' "$f" \ - | sed -E 's/.*\((.*)\).*/\1/' + | sed -E 's/.*\((.*)\).*/\1/' - # Markdown images grep -oE '!\[[^]]*\]\([^)]*\)' "$f" \ - | sed -E 's/.*\((.*)\).*/\1/' + | sed -E 's/.*\((.*)\).*/\1/' - # Raw URLs grep -oE 'https?://[^ )"]+' "$f" - # grep -oE ']*src="[^"]+"' "$f" \ - | sed -E 's/.*src="([^"]*)".*/\1/' + | sed -E 's/.*src="([^"]*)".*/\1/' - #