rstudio / pins-r

Pin, Discover and Share Resources
https://pins.rstudio.com
Other
301 stars 62 forks source link

`pin_write` error due to duplicate folder name in gdrive #818

Closed UchidaMizuki closed 5 months ago

UchidaMizuki commented 5 months ago

In gdrive_board, pin_write throws an error when there are folders with duplicate folder names with the board. The error also occurs for shortcuts and between folders of different hierarchies.

The cause of the error seems to be that pins:::gdrive_mkdir uses name of the board's dribble instead of its id. The error occurs as follows,

library(pins)
library(googledrive)
drive_auth("uchidamizuki@vivaldi.net")

board <- board_gdrive(as_id("11wUPQi82qsXArmMeu3ENdUK_QvdU1rMv"))
board |> 
  pin_write(iris, "iris")
#> Guessing `type = 'rds'`
#> Creating new version '20240111T105439Z-d16b7'
#> Error in `as_parent()`:
#> ! Parent specified via `path` is invalid:
#> ✖ Doesn't uniquely identify exactly one folder or shared drive.
#> Backtrace:
#>      ▆
#>   1. └─pins::pin_write(board, iris, "iris")
#>   2.   ├─pins::pin_store(...)
#>   3.   └─pins:::pin_store.pins_board_gdrive(...)
#>   4.     └─pins:::gdrive_mkdir(board$dribble$name, name)
#>   5.       └─googledrive::drive_mkdir(name, dir, overwrite = FALSE)
#>   6.         └─googledrive::drive_create(...)
#>   7.           └─googledrive:::as_parent(path)
#>   8.             └─googledrive:::drive_abort(c(invalid_parent, x = "Doesn't uniquely identify exactly one folder or shared drive."))
#>   9.               └─cli::cli_abort(message = message, ..., .envir = .envir)
#>  10.                 └─rlang::abort(...)

Created on 2024-01-11 with reprex v2.0.2

github-actions[bot] commented 5 months ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.