fix: Diagrams.net proxy path considered as embeddable

This commit is contained in:
Tom Moor
2022-07-21 10:51:34 +01:00
parent ba264974cf
commit 80d50e3d88
2 changed files with 7 additions and 1 deletions

View File

@@ -11,6 +11,12 @@ describe("Diagrams", () => {
).toBeTruthy();
});
test("to not be enabled on the proxy path", () => {
expect("https://app.diagrams.net/proxy?url=malicious".match(match)).toBe(
null
);
});
test("to not be enabled elsewhere", () => {
expect("https://app.diagrams.net/#ABCDefgh_A12345-6789".match(match)).toBe(
null

View File

@@ -3,7 +3,7 @@ import Frame from "../components/Frame";
import Image from "../components/Image";
import { EmbedProps as Props } from ".";
const URL_REGEX = /^https:\/\/viewer\.diagrams\.net\/.*(title=\\w+)?/;
const URL_REGEX = /^https:\/\/viewer\.diagrams\.net\/(?!proxy).*(title=\\w+)?/;
export default class Diagrams extends React.Component<Props> {
static ENABLED = [URL_REGEX];