fix: Make GoogleDrive embed links more lenient

closes #2405
This commit is contained in:
Tom Moor
2021-08-30 22:43:13 -07:00
parent 4929fbaccb
commit 23a6459ae8
2 changed files with 1 additions and 18 deletions

View File

@@ -3,9 +3,7 @@ import * as React from "react";
import Image from "components/Image";
import Frame from "./components/Frame";
const URL_REGEX = new RegExp(
"^https?://drive.google.com/file/d/(.*)/(preview|view).?usp=sharing(.*)"
);
const URL_REGEX = new RegExp("^https?://drive.google.com/file/d/(.*)$");
type Props = {|
attrs: {|

View File

@@ -23,21 +23,6 @@ describe("GoogleDrive", () => {
});
test("to not be enabled elsewhere", () => {
expect(
"https://drive.google.com/file/d/1ohkOgmE8MiNx68u6ynBfYkgjeKu_x3ZK/view".match(
match
)
).toBe(null);
expect(
"https://drive.google.com/file/d/1ohkOgmE8MiNx68u6ynBfYkgjeKu_x3ZK/preview".match(
match
)
).toBe(null);
expect(
"https://drive.google.com/file/d/1ohkOgmE8MiNx68u6ynBfYkgjeKu_x3ZK/view?usp=restricted".match(
match
)
).toBe(null);
expect("https://drive.google.com/file".match(match)).toBe(null);
expect("https://drive.google.com".match(match)).toBe(null);
expect("https://www.google.com".match(match)).toBe(null);