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: allow saving notebooks on /tmp_mnt paths (#7641)

Myles Scolnick58bc50944899
diff --git a/frontend/src/core/saving/__tests__/save-component.test.ts b/frontend/src/core/saving/__tests__/save-component.test.ts
new file mode 100644
index 0000000000..29819fa97b
--- /dev/null
+++ b/frontend/src/core/saving/__tests__/save-component.test.ts
@@ -0,0 +1,20 @@
+/* Copyright 2026 Marimo. All rights reserved. */
+
+import { describe, expect, it } from "vitest";
+import { isNamedPersistentFile } from "../save-component";
+
+describe("isNamedPersistentFile", () => {
+ it.each([
+ [null, false],
+ // Temp paths should return false
+ ["/tmp/notebook.py", false],
+ ["/var/folders/ab/cd/T/notebook.py", false],
+ ["C:\\Users\\user\\AppData\\Local\\Temp\\notebook.py", false],
+ // /tmp_mnt is a mount point, not a temp directory (bug fix)
+ ["/tmp_mnt/notebook.py", true],
+ // Normal paths should return true
+ ["/home/user/project/notebook.py", true],
+ ])("isNamedPersistentFile(%s) => %s", (filename, expected) => {
+ expect(isNamedPersistentFile(filename)).toBe(expected);
+ });
+});
diff --git a/frontend/src/core/saving/save-component.tsx b/frontend/src/core/saving/save-component.tsx
index 42bf5c8068..2d0e85ffcb 100644
--- a/frontend/src/core/saving/save-component.tsx
+++ b/frontend/src/core/saving/save-component.tsx
@@ -193,11 +193,13 @@ export function useSaveNotebook() {
};
}
-function isNamedPersistentFile(filename: string | null): filename is string {
+export function isNamedPersistentFile(
+ filename: string | null,
+): filename is string {
return (
filename !== null &&
// Linux
- !filename.startsWith("/tmp") &&
+ !filename.startsWith("/tmp/") &&
// macOS
!filename.startsWith("/var/folders") &&
// Windows