fix: e2e test — copy fixture into recordings dir for path security check
The test fixture path is outside RECORDINGS_DIR, so set-current-video-path rejects it after the path traversal fix. Copy the fixture into the app recordings directory before loading it.
This commit is contained in:
@@ -62,10 +62,10 @@ test("exports a GIF from a loaded video", async () => {
|
||||
// Copy the test fixture into the app's recordings directory so it passes
|
||||
// the path security check in set-current-video-path (which only allows
|
||||
// paths inside RECORDINGS_DIR or explicitly user-approved paths).
|
||||
const recordingsDir = await app.evaluate(({ app: electronApp }) => {
|
||||
const path = require("node:path");
|
||||
return path.join(electronApp.getPath("userData"), "recordings");
|
||||
const userDataDir = await app.evaluate(({ app: electronApp }) => {
|
||||
return electronApp.getPath("userData");
|
||||
});
|
||||
const recordingsDir = path.join(userDataDir, "recordings");
|
||||
testVideoInRecordings = path.join(recordingsDir, "test-sample.webm");
|
||||
fs.mkdirSync(recordingsDir, { recursive: true });
|
||||
fs.copyFileSync(TEST_VIDEO, testVideoInRecordings);
|
||||
|
||||
Reference in New Issue
Block a user