Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

test(export): tighten media path regression coverage

wiiiii1231449267ba288
diff --git a/electron/ipc/project/manager.test.ts b/electron/ipc/project/manager.test.ts
index 3f360ee4..375d0f9d 100644
--- a/electron/ipc/project/manager.test.ts
+++ b/electron/ipc/project/manager.test.ts
@@ -64,4 +64,13 @@ describe("local media path policy", () => {
await expect(isAllowedLocalMediaPath(missingPath)).resolves.toBe(false);
});
+
+ it("allows approved media paths before the file exists", async () => {
+ const pendingExportPath = path.join(tempRoot, "Downloads", "pending-export.mp4");
+ const { isAllowedLocalMediaPath, rememberApprovedLocalReadPath } = await import("./manager");
+
+ await rememberApprovedLocalReadPath(pendingExportPath);
+
+ await expect(isAllowedLocalMediaPath(pendingExportPath)).resolves.toBe(true);
+ });
});
diff --git a/electron/ipc/project/manager.ts b/electron/ipc/project/manager.ts
index 862af43e..e13127f6 100644
--- a/electron/ipc/project/manager.ts
+++ b/electron/ipc/project/manager.ts
@@ -64,10 +64,7 @@ export function isAllowedLocalReadPath(candidatePath: string) {
// saved outside the active recording session can still be reopened in the editor.
export async function isAllowedLocalMediaPath(candidatePath: string) {
const normalizedCandidatePath = normalizePath(candidatePath);
- const realPath = await fs.realpath(normalizedCandidatePath).catch(() => normalizedCandidatePath);
- return (
- isAllowedLocalReadPath(normalizedCandidatePath) || isAllowedLocalReadPath(realPath)
- );
+ return isAllowedLocalReadPath(normalizedCandidatePath);
}
export async function rememberApprovedLocalReadPath(filePath?: string | null) {
diff --git a/electron/ipc/register/project.ts b/electron/ipc/register/project.ts
index 70b0fe0b..dee0af16 100644
--- a/electron/ipc/register/project.ts
+++ b/electron/ipc/register/project.ts
@@ -16,27 +16,25 @@ import {
currentRecordingSession,
setCurrentRecordingSession,
} from "../state";
-import { normalizeVideoSourcePath } from "../utils";
import {
+ getProjectsDir,
isAllowedLocalMediaPath,
isPathInsideDirectory,
+ isTrustedProjectPath,
+ listProjectLibraryEntries,
+ loadProjectFromPath,
+ persistRecordingsDirectorySetting,
replaceApprovedSessionLocalReadPaths,
+ rememberRecentProject,
+ saveProjectThumbnail,
} from "../project/manager";
import {
getTelemetryPathForVideo,
isAutoRecordingPath,
getRecordingsDir,
approveUserPath,
+ normalizeVideoSourcePath,
} from "../utils";
-import {
- getProjectsDir,
- persistRecordingsDirectorySetting,
- saveProjectThumbnail,
- rememberRecentProject,
- listProjectLibraryEntries,
- loadProjectFromPath,
- isTrustedProjectPath,
-} from "../project/manager";
import { persistRecordingSessionManifest, resolveRecordingSession } from "../project/session";
function normalizeRecordingTimeOffsetMs(value: unknown): number {