diff --git a/src/lib/utils/embed.ts b/src/lib/utils/embed.ts index b2a9255ea..f9b01e207 100644 --- a/src/lib/utils/embed.ts +++ b/src/lib/utils/embed.ts @@ -287,6 +287,7 @@ export const settingsConfig: Record = { * @param url */ export function isEmbed(url: URL): Boolean { + if (!url.pathname.match(/^\/(documents|projects)/)) return false; return ( url.searchParams.has("embed") || url.hostname === "embed.documentcloud.org" ); diff --git a/src/lib/utils/tests/embed.test.ts b/src/lib/utils/tests/embed.test.ts index fb47d996b..8c0c6ee69 100644 --- a/src/lib/utils/tests/embed.test.ts +++ b/src/lib/utils/tests/embed.test.ts @@ -55,6 +55,10 @@ describe("embed utilities", () => { "https://www.documentcloud.org/documents/2622-agreement-between-conservatives-and-liberal-democrats-to-form-a-coalition-government/?embed", true, ], + [ + "https://embed.documentcloud.org/_app/immutable/chunks/navigation.CziXxwWJ.js", + false, + ], ]; for (const [url, embed] of urls) {