From 03a05c135a5aa46eb4c614623a170ba28a700d44 Mon Sep 17 00:00:00 2001 From: Adam Shiervani Date: Thu, 23 Oct 2025 15:16:53 +0000 Subject: [PATCH] refactor: improve URL handling in RebootingOverlay component --- ui/src/components/VideoOverlay.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ui/src/components/VideoOverlay.tsx b/ui/src/components/VideoOverlay.tsx index e59c0987..7697399b 100644 --- a/ui/src/components/VideoOverlay.tsx +++ b/ui/src/components/VideoOverlay.tsx @@ -475,8 +475,14 @@ export function RebootingOverlay({ show, postRebootAction }: RebootingOverlayPro if (response.ok) { // Device is available, redirect to the specified URL console.log('Device is available, redirecting to:', postRebootAction.redirectUrl); - window.location.href = postRebootAction.redirectUrl; - window.location.reload(); + + // URL constructor handles all cases elegantly: + // - Absolute paths: resolved against current origin + // - Protocol-relative URLs: resolved with current protocol + // - Fully qualified URLs: used as-is + const targetUrl = new URL(postRebootAction.redirectUrl, window.location.origin); + + window.location.href = targetUrl.href; } } catch (err) { // Ignore errors - they're expected while device is rebooting