diff --git a/packages/studio-server/src/routes/files.renameReferences.test.ts b/packages/studio-server/src/routes/files.renameReferences.test.ts
index 20ee3ad25b..45c50d053b 100644
--- a/packages/studio-server/src/routes/files.renameReferences.test.ts
+++ b/packages/studio-server/src/routes/files.renameReferences.test.ts
@@ -338,12 +338,61 @@ describe("renaming a folder over the route", () => {
join(project, "a", "style.css"),
'url(b/../logo.png) url(b/sub/../../logo.png) url(b\\.\\..\\logo.png) url("b/../in/logo.png") url("b/sub dir/../../logo.png") url("b/s,(;)/../../logo.png") url(b/image.png)',
);
- writeFileSync(join(project, "index.html"), '
');
expect((await renameIn(project, "a/b", "b/c")).status).toBe(200);
expect(readFileSync(join(project, "a", "style.css"), "utf8")).toBe(
'url(b/../logo.png) url(b/sub/../../logo.png) url(b\\.\\..\\logo.png) url("b/../in/logo.png") url("b/sub dir/../../logo.png") url("b/s,(;)/../../logo.png") url(../b/c/image.png)',
);
- expect(readFileSync(join(project, "index.html"), "utf8")).toBe('
');
+ });
+
+ it("in HTML takes the folder reading only where its file exists, else leaves the root path to the root pass", async () => {
+ const project = mkdtempSync(join(tmpdir(), "hf-rename-refs-"));
+ dirs.push(project);
+ mkdirSync(join(project, "assets"));
+ mkdirSync(join(project, "compositions", "assets"), { recursive: true });
+ writeFileSync(join(project, "assets", "logo.png"), "x");
+ writeFileSync(join(project, "compositions", "assets", "bg.png"), "x");
+ writeFileSync(
+ join(project, "compositions", "hero.html"),
+ '
',
+ );
+
+ expect((await renameIn(project, "compositions/assets", "compositions/media")).status).toBe(200);
+ expect(readFileSync(join(project, "compositions", "hero.html"), "utf8")).toBe(
+ '
',
+ );
+ });
+
+ it("in HTML gives a path the runtime reads from the root to the root pass, where both readings match", async () => {
+ const project = mkdtempSync(join(tmpdir(), "hf-rename-refs-"));
+ dirs.push(project);
+ mkdirSync(join(project, "scenes", "scenes"), { recursive: true });
+ writeFileSync(join(project, "scenes", "scenes", "clip.mp4"), "x");
+ writeFileSync(join(project, "scenes", "intro.html"), '