don't strip the fallback detect size when cloning

This commit is contained in:
Josh Hawkins
2026-11-28 18:30:43 -06:00
parent 63807d753c
commit 140680215b
2 changed files with 1 additions and 54 deletions
-48
View File
@@ -19,19 +19,8 @@
* and no PUT. That path is covered by unit-level review and manual QA.
*/
import { readFileSync } from "node:fs";
import { resolve, dirname } from "node:path";
import { fileURLToPath } from "node:url";
import { test, expect } from "../fixtures/frigate-test";
const __dirname = dirname(fileURLToPath(import.meta.url));
const CONFIG_SCHEMA = JSON.parse(
readFileSync(
resolve(__dirname, "../fixtures/mock-data/config-schema.json"),
"utf-8",
),
);
async function openCloneDialog(frigateApp: {
page: import("@playwright/test").Page;
}) {
@@ -148,43 +137,6 @@ test.describe("Camera clone dialog @medium @mobile", () => {
).toBeVisible({ timeout: 8_000 });
});
test("does not copy a fallback detect resolution to a new camera", async ({
frigateApp,
}) => {
await frigateApp.installDefaults({
config: {
cameras: { front_door: { detect_resolution_source: "default" } },
},
});
// section payloads need the schema, which the default mock leaves empty
await frigateApp.page.route("**/api/config/schema.json", (route) =>
route.fulfill({ json: CONFIG_SCHEMA }),
);
const requests: unknown[] = [];
await frigateApp.page.route("**/api/config/set", async (route) => {
requests.push(route.request().postDataJSON());
await route.fulfill({ json: { success: true, require_restart: false } });
});
await frigateApp.goto("/settings?page=cameraManagement");
await openCloneDialog(frigateApp);
await selectSource(frigateApp, "Front Door");
await frigateApp.page
.getByPlaceholder(/e\.g\., back_door or Back Door/i)
.fill("clone_target_two");
await frigateApp.page.getByRole("button", { name: /^Clone$/i }).click();
await expect.poll(() => requests.length, { timeout: 10_000 }).toBe(1);
const body = requests[0] as {
config_data: {
cameras: { clone_target_two: { detect?: Record<string, unknown> } };
};
};
const detect = body.config_data.cameras.clone_target_two.detect ?? {};
expect(detect).not.toHaveProperty("width");
expect(detect).not.toHaveProperty("height");
});
test("selects multiple existing destination cameras via a switch popover", async ({
frigateApp,
}) => {
+1 -6
View File
@@ -672,14 +672,9 @@ export function buildClonedCameraPayloads({
formData: sourceSectionValue as ConfigSectionData,
},
);
// a fallback detect size would become an explicit value on the target
const fallbackDetect =
section === "detect" && sourceCfg.detect_resolution_source === "default"
? ["width", "height"]
: [];
let pendingSectionValue: unknown = sanitizeSectionData(
cloneDeep(sourceSectionValue) as ConfigSectionData,
[...resolvedHiddenFields, ...fallbackDetect],
resolvedHiddenFields,
);
if (FILTER_SECTION_DEFS[section]) {