Skip to content

Commit 09b0468

Browse files
vanceingallsclaude
andauthored
fix(studio): compare a remote url as serialized, decode only local paths
A remote pathname with an encoded reserved character (%3F) matched the same path with a literal ?, though they can return different media. Remote urls keep origin, path and query exactly; local srcs are still decoded and stripped of query and hash. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent 6627439 commit 09b0468

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎packages/studio/src/player/components/audioClipLink.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ describe("mediaAssetIdentity", () => {
5252
expect(mediaAssetIdentity({ src: "https://cdn.example.com/v.mp4?clip=a%26x=b" })).not.toBe(
5353
mediaAssetIdentity({ src: "https://cdn.example.com/v.mp4?clip=a&x=b" }),
5454
);
55+
expect(mediaAssetIdentity({ src: "https://cdn.example.com/v.mp4%3Fclip=a" })).not.toBe(
56+
mediaAssetIdentity({ src: "https://cdn.example.com/v.mp4?clip=a" }),
57+
);
5558
expect(mediaAssetIdentity({ src: "https://cdn.example.com/v.mp4?id=1#t=3" })).toBe(
5659
mediaAssetIdentity({ src: "https://cdn.example.com/v.mp4?id=1" }),
5760
);

‎packages/studio/src/player/components/audioClipLink.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export function mediaAssetIdentity(
1515
if (!src) return null;
1616
try {
1717
const url = new URL(src, new URL(element.sourceFile ?? "index.html", SOURCE_BASE));
18-
const query = url.origin === SOURCE_ORIGIN ? "" : url.search;
19-
return `${url.origin}${decodeURIComponent(url.pathname)}${query}`;
18+
if (url.origin !== SOURCE_ORIGIN) return `${url.origin}${url.pathname}${url.search}`;
19+
return decodeURIComponent(`${url.origin}${url.pathname}`);
2020
} catch {
2121
return null;
2222
}

0 commit comments

Comments
 (0)