ropensci / piggyback

:package: for using large(r) data files on GitHub
https://docs.ropensci.org/piggyback
GNU General Public License v3.0
182 stars 26 forks source link

pb_upload does not respect dir arg for relative directories #55

Closed tanho63 closed 2 years ago

tanho63 commented 2 years ago

pb_upload is supposed to take a directory argument for relative paths as per https://docs.ropensci.org/piggyback/reference/pb_upload.html but currently does not check the specified directory before returning NULL https://github.com/ropensci/piggyback/blob/99f36e1f808f10e9fe162ab23d0da74fade1e016/R/pb_upload.R#L59-L71

fix might look like

dir defaults to NULL (since it's not being used atm)
if (!is.null(dir)) file <- file.path(dir, file)

etc (perhaps computing name first)

cboettig commented 2 years ago

Thanks. Yeah, piggyback initially included logic for relative paths and for preserving folder hierarchy in the uploads, effectively by name mangling. More recently I have concluded that was a mistake -- I think users should stick with a flat object-based approach to storage. However, the old logic was never fully ripped out either. Cleaning this up would be very welcome!