Skip to content

Commit ed574d9

Browse files
committed
Anticipate another type of link
Fixes #450
1 parent 74a69a3 commit ed574d9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

R/drive_id-class.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ pillar_shaft.drive_id <- function(x, ...) {
153153
## /d/FILE_ID Drive file
154154
## /folders/FILE_ID Drive folder
155155
## id=FILE_ID uploaded blob
156-
id_regexp <- "(/d/|/folders/|id=)[^/]+"
156+
id_regexp <- "(/d/|/folders/|id=)[^/?]+"
157157

158158
is_drive_url <- function(x) grepl("^http", x) & grepl(id_regexp, x)
159159

tests/testthat/test-drive_id-class.R

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,17 @@ test_that("as_id() extracts ids from Drive URLs but not other URLs", {
3030
x <- c(
3131
"https://docs.google.com/document/d/doc12345/edit",
3232
"https://drive.google.com/drive/folders/folder12345",
33+
# https://github.com/tidyverse/googledrive/issues/450
34+
"https://drive.google.com/drive/folders/folder12345?usp=drive_link",
3335
"https://drive.google.com/open?id=blob12345",
3436
"https://docs.google.com/a/example.com/spreadsheets/d/team12345",
35-
## Team Drive URL
37+
# Team Drive URL
3638
"https://drive.google.com/drive/u/0/folders/teamdrive12345"
3739
)
3840
expect_identical(
3941
as_id(x),
4042
as_id(c(
41-
"doc12345", "folder12345", "blob12345",
43+
"doc12345", "folder12345", "folder12345", "blob12345",
4244
"team12345", "teamdrive12345"
4345
))
4446
)

0 commit comments

Comments
 (0)