ropensci / osfr

R interface to the Open Science Framework (OSF)
https://docs.ropensci.org/osfr
Other
143 stars 28 forks source link

Uploading to a directory fails when a conflicting file is present #121

Closed aaronwolen closed 4 years ago

aaronwolen commented 4 years ago
library(osfr)
#> Automatically registered OSF personal access token
#> <Logging enabled: ~/Library/Logs/osfr.log>
#> <Testing server enabled: test.osf.io>
p1 <- osf_create_project("dir-upload-bug")
d1 <- osf_mkdir(p1, "uploads")

osf_upload(d1, system.file("CITATION"))
#> # A tibble: 1 x 3
#>   name     id                       meta            
#>   <chr>    <chr>                    <list>          
#> 1 CITATION 5e46a657d1833a0009333517 <named list [3]>
osf_upload(d1, system.file("CITATION"), conflicts = "skip")
#> Error: Cannot complete action: file or folder "CITATION" already exists in this location
#>        HTTP status code 409.

Created on 2020-02-14 by the reprex package (v0.3.0)

mnoetel commented 4 years ago

Interesting that this only happens to me when the target is a folder:

public_dat <- osf_retrieve_node("u5x3r") %>% osf_ls_files(pattern = "Data") public_dat %>% osf_upload(file_name_descriptives, conflicts = "overwrite", verbose = T) Searching for conflicting files on OSF Uploading 1 new file(s) to OSF Error: Cannot complete action: file or folder "latest_descriptives_of_each_variable.csv" already exists in this location HTTP status code 409.

public_dat <- osf_retrieve_node("u5x3r") public_dat %>% osf_upload(file_name_descriptives, conflicts = "overwrite", verbose = T) Searching for conflicting files on OSF Uploading 1 new file(s) to OSF Uploaded new file 'latest_descriptives_of_each_variable.csv' to OSF

public_dat %>% osf_upload(file_name_descriptives, conflicts = "overwrite", verbose = T) Searching for conflicting files on OSF Updating 1 existing file(s) on OSF Uploaded new version of 'latest_descriptives_of_each_variable.csv' to OSF