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 <noreply@anthropic.com>
This commit is contained in:
parent
823a35bb9a
commit
f91b8d0d98
1 changed files with 3 additions and 1 deletions
|
|
@ -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:<pat>@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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue