From f91b8d0d98cb1dca7f9f7140d545c5c72b4a853b Mon Sep 17 00:00:00 2001 From: Erich Blume Date: Tue, 3 Mar 2026 11:46:41 -0800 Subject: [PATCH] Fix mirror-update-pats corrupting all GitHub mirror URLs The bash parameter expansion `${var/pat/rep}` treats `\/` in the replacement as a literal backslash-slash, not an escaped delimiter. This produced URLs like `https:\/\/eblume:...` instead of `https://eblume:...`, breaking Forgejo's URL parser (500 on mirror settings pages) and preventing mirror syncs. Use prefix stripping (`${var#prefix}`) instead. All 22 corrupted mirrors have been repaired on indri. Co-Authored-By: Claude Opus 4.6 --- mise-tasks/mirror-update-pats | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mise-tasks/mirror-update-pats b/mise-tasks/mirror-update-pats index 4a66b76..fcb71ff 100755 --- a/mise-tasks/mirror-update-pats +++ b/mise-tasks/mirror-update-pats @@ -39,7 +39,9 @@ while IFS='|' read -r org repo upstream_url; do bare_repo="${REPO_BASE}/${org}/${repo}.git" # Build authenticated URL: https://eblume:@github.com/... - auth_url="${upstream_url/https:\/\/github.com/https:\/\/eblume:${pat}@github.com}" + # Note: \/ in the replacement part of ${var/pat/rep} is literal backslash-slash, + # not an escaped slash. Use prefix stripping instead. + auth_url="https://eblume:${pat}@github.com${upstream_url#https://github.com}" if [[ "$DRY_RUN" == "true" ]]; then echo "[dry-run] ${org}/${repo}: would set origin to authenticated URL"