fix: GoogleDrive embeds stopped working with new share urls
closes #2405
This commit is contained in:
parent
21d3b9c7e0
commit
dd249021e7
|
@ -4,7 +4,7 @@ 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$"
|
||||
"^https?://drive.google.com/file/d/(.*)/(preview|view).?usp=sharing(.*)"
|
||||
);
|
||||
|
||||
type Props = {|
|
||||
|
@ -29,7 +29,7 @@ export default class GoogleDrive extends React.Component<Props> {
|
|||
height={16}
|
||||
/>
|
||||
}
|
||||
title="Google Drive Embed"
|
||||
title="Google Drive"
|
||||
canonicalUrl={this.props.attrs.href}
|
||||
border
|
||||
/>
|
||||
|
|
|
@ -3,6 +3,7 @@ import GoogleDrive from "./GoogleDrive";
|
|||
|
||||
describe("GoogleDrive", () => {
|
||||
const match = GoogleDrive.ENABLED[0];
|
||||
|
||||
test("to be enabled on share link", () => {
|
||||
expect(
|
||||
"https://drive.google.com/file/d/1ohkOgmE8MiNx68u6ynBfYkgjeKu_x3ZK/view?usp=sharing".match(
|
||||
|
@ -14,6 +15,11 @@ describe("GoogleDrive", () => {
|
|||
match
|
||||
)
|
||||
).toBeTruthy();
|
||||
expect(
|
||||
"https://drive.google.com/file/d/1ohkOgmE8MiNx68u6ynBfYkgjeKu_x3ZK/preview?usp=sharing&resourceKey=BG8k4dEt1p2gisnVdlaSpA".match(
|
||||
match
|
||||
)
|
||||
).toBeTruthy();
|
||||
});
|
||||
|
||||
test("to not be enabled elsewhere", () => {
|
||||
|
|
Reference in New Issue