Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: handle blob protocol in runtime manager (#6071)

Myles Scolnickee4cc9ee42e5
diff --git a/frontend/src/core/runtime/__tests__/config.test.ts b/frontend/src/core/runtime/__tests__/config.test.ts
index f6181361d7..9fd97f0382 100644
--- a/frontend/src/core/runtime/__tests__/config.test.ts
+++ b/frontend/src/core/runtime/__tests__/config.test.ts
@@ -100,6 +100,18 @@ describe("runtime config", () => {
});
});
+ describe("asRemoteURL with blob", () => {
+ it("should handle blob URLs", () => {
+ const customRuntimeManager = {
+ httpURL: new URL("blob:http://localhost:8080"),
+ } as RuntimeManager;
+ mockedStore.get.mockReturnValue(customRuntimeManager);
+
+ const result = asRemoteURL("./path/to/file.txt");
+ expect(result.toString()).toBe("http://localhost:8080/path/to/file.txt");
+ });
+ });
+
describe("getRuntimeManager", () => {
it("should return runtime manager from store", () => {
const result = getRuntimeManager();
diff --git a/frontend/src/core/runtime/config.ts b/frontend/src/core/runtime/config.ts
index b5a6ccf046..e6d017ebce 100644
--- a/frontend/src/core/runtime/config.ts
+++ b/frontend/src/core/runtime/config.ts
@@ -36,5 +36,10 @@ export function asRemoteURL(path: string): URL {
if (path.startsWith("http")) {
return new URL(path);
}
- return new URL(path, getRuntimeManager().httpURL.toString());
+ let base = getRuntimeManager().httpURL.toString();
+ if (base.startsWith("blob:")) {
+ // Remove leading blob:
+ base = base.replace("blob:", "");
+ }
+ return new URL(path, base);
}