Skip to content

Commit

Permalink
fix: GoogleDrive embeds stopped working with new share urls
Browse files Browse the repository at this point in the history
  • Loading branch information
tommoor committed Aug 2, 2021
1 parent 21d3b9c commit dd24902
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/embeds/GoogleDrive.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {|
Expand All @@ -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
/>
Expand Down
6 changes: 6 additions & 0 deletions app/embeds/GoogleDrive.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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", () => {
Expand Down

0 comments on commit dd24902

Please sign in to comment.