diff --git a/DESCRIPTION b/DESCRIPTION index 77619a4..2944ef9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: sbtools Title: USGS ScienceBase Tools Maintainer: Luke Winslow -Version: 0.13.3 +Version: 0.13.4 Authors@R: c(person("Luke", "Winslow", role = c("aut","cre"), email = "lwinslow@usgs.gov"), person("Scott", "Chamberlain", role = c("aut"), diff --git a/R/item_file_download.R b/R/item_file_download.R index cf83561..a53adcf 100644 --- a/R/item_file_download.R +++ b/R/item_file_download.R @@ -50,7 +50,7 @@ item_file_download = function(id, ..., names, destinations, dest_dir, session=cu destinations = file.path(dest_dir, names) #or we have names and destinations - }else{ + }else if(!missing(names) & !missing(destinations)){ if(length(names) != length(destinations)){ stop('Length of names and destinations must be identical') } @@ -60,6 +60,9 @@ item_file_download = function(id, ..., names, destinations, dest_dir, session=cu if(!all(names %in% flist$fname)){ stop('Item does not contain all requested files') } + #otherwise in some other error condition + }else{ + stop('Must have either names & destinations, or dest_dir for all files') } diff --git a/R/item_update_identifier.R b/R/item_update_identifier.R index 2fa2eaf..1dcc2a7 100644 --- a/R/item_update_identifier.R +++ b/R/item_update_identifier.R @@ -39,8 +39,8 @@ item_update_identifier = function(id, scheme, type, key, ..., session=current_se } data = list(scheme=unbox(scheme), type=unbox(type), key=unbox(key)) - - data = merge_identifiers(original$identifiers, data) + + data = merge_identifiers(unbox_identifiers(original$identifiers), data) info = list(identifiers=data) @@ -69,3 +69,16 @@ merge_identifiers = function(original, updated){ original[[length(original)+1]] = updated return(original) } + +unbox_identifiers = function(idents){ + if(length(idents) < 1){ + return(idents) + } + + for(i in 1:length(idents)){ + idents[[i]]$type = unbox(idents[[i]]$type) + idents[[i]]$scheme = unbox(idents[[i]]$scheme) + idents[[i]]$key = unbox(idents[[i]]$key) + } + return(idents) +}