From 0559524183864cac23b30d3ace3e1921ad33dbb9 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Fri, 11 Oct 2024 13:25:03 -0700 Subject: [PATCH] Fix simx path formatting issue (#10229) * fix path formatting issue * simpler fix * restore comment --- pxtsim/simdriver.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pxtsim/simdriver.ts b/pxtsim/simdriver.ts index edd30cac22a..327a6a048b3 100644 --- a/pxtsim/simdriver.ts +++ b/pxtsim/simdriver.ts @@ -163,7 +163,8 @@ namespace pxsim { const simPath = simUrl.pathname.replace(/---?.*/, ""); // Construct the path. The "-" element delineates the extension key from the resource name. const simxPath = [simPath, "simx", key, "-", simx.index].join("/"); - simx.url = new URL(simxPath, simUrl.origin).toString(); + // Create the fully-qualified URL, preserving the origin by removing all leading slashes + simx.url = new URL(simxPath.replace(/^\/+/, ""), simUrl.origin).toString(); } // Add the origin to the allowed origins