mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-25 07:16:02 +00:00
test(export): tighten media path regression coverage
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user