From ddaf94e1d2d796df3a0d965ef6bf807c85f403f1 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Thu, 20 Nov 2025 13:23:34 +0100 Subject: [PATCH] Simplify file sanitization process in workflow Refactor sanitization logic to handle text files directly without conditional checks. --- .github/workflows/onpush_builder.yaml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/workflows/onpush_builder.yaml b/.github/workflows/onpush_builder.yaml index 014548c1d..16009aad3 100644 --- a/.github/workflows/onpush_builder.yaml +++ b/.github/workflows/onpush_builder.yaml @@ -56,18 +56,14 @@ jobs: find . -type f | while read -r file; do MIME_TYPE=$(file --mime-type -b "$file") + [[ "$MIME_TYPE" != text/* ]] && continue - if [[ "$MIME_TYPE" == text/* ]]; then - echo "Sanitizing $file" - # 1️⃣ Replace exotic spaces → regular space - # 2️⃣ Strip 0x0D (CR) at end of every line - perl -CSD -pe " - s/${UNICODE_SPACES_REGEX}/ /g; # space normalization - s/\r$//; # CRLF → LF - " "$file" > "$file.tmp" && mv "$file.tmp" "$file" - else - echo "Skipping non-text file: $file ($MIME_TYPE)" - fi + echo "Sanitizing $file" + # Edit in place, preserving file permissions and metadata + perl -i -CSD -pe " + s/${UNICODE_SPACES_REGEX}/ /g; # space normalization + s/\r$//; # CRLF → LF + " "$file" done # ──────────────────────────────────────────────────────────────── # 2. Ensure every *.sh script is executable