Skip to content

Commit

Permalink
Support usp=share_link by not validating query parameter at all (#11)
Browse files Browse the repository at this point in the history
Co-authored-by: Richie Bendall <[email protected]>
  • Loading branch information
HarmlessHarm and Richienb committed Oct 17, 2023
1 parent fa0251b commit f4f89eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const formatRegexes = new Set([
/https:\/\/drive\.google\.com\/file\/d\/(?<id>.*?)\/(?:edit|view)\?usp=(drive_link|sharing)/,
/https:\/\/drive\.google\.com\/file\/d\/(?<id>.*?)\/(?:edit|view)/,
/https:\/\/drive\.google\.com\/open\?id=(?<id>.*?)$/,
]);

Expand Down
6 changes: 6 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ test('main', t => {
),
'https://drive.google.com/uc?export=download&id=1Px8bePd7pFSz5r6bTA7GKN9HloCzMfFk',
);
t.is(
driveUrl(
'https://drive.google.com/file/d/1Px8bePd7pFSz5r6bTA7GKN9HloCzMfFk/view?usp=share_link',
),
'https://drive.google.com/uc?export=download&id=1Px8bePd7pFSz5r6bTA7GKN9HloCzMfFk',
);
t.is(
driveUrl(
'https://drive.google.com/file/d/1Px8bePd7pFSz5r6bTA7GKN9HloCzMfFk/view?usp=sharing',
Expand Down

0 comments on commit f4f89eb

Please sign in to comment.