From d4fb45f862b031d92b8451e5ddae721f7fa5cdbd Mon Sep 17 00:00:00 2001 From: YueGuobin Date: Wed, 3 Jun 2026 11:25:00 +0800 Subject: [PATCH] Fix web-ui update script to handle custom GitHub URL changes When using --url parameter with a different GitHub repository, the script now checks if the existing clone's remote matches the provided URL. If they don't match, it removes the old clone and re-clones from the new URL. This prevents errors when switching between different forks or branches of the gns3-web-ui repository. --- scripts/update-bundled-web-ui.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/update-bundled-web-ui.sh b/scripts/update-bundled-web-ui.sh index 70742e253..33f8a1736 100755 --- a/scripts/update-bundled-web-ui.sh +++ b/scripts/update-bundled-web-ui.sh @@ -94,6 +94,15 @@ if [ "$CUSTOM_REPO" = false ] ; then else git clone https://github.com/GNS3/gns3-web-ui.git "$REPO_DIR" fi + elif [[ -n "$GITHUB_URL" ]]; then + # Check if existing clone's remote matches the custom URL + EXISTING_REMOTE=$(cd "$REPO_DIR" && git config --get remote.origin.url) + if [[ "$EXISTING_REMOTE" != "$GITHUB_URL" ]]; then + echo "Remote URL mismatch: $EXISTING_REMOTE != $GITHUB_URL" + echo "Removing old clone and re-cloning..." + rm -rf "$REPO_DIR" + git clone "$GITHUB_URL" "$REPO_DIR" + fi fi cd "$REPO_DIR"