Skip to content

Commit edfa178

Browse files
authored
Merge pull request #28 from OldLipe/b-0.9.0
fix assets_download extensions name bug (closes #27)
2 parents ef0819d + 7c5aa8c commit edfa178

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

.drone.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ steps:
66
image: brazildatacube/r-webservices:1.0.0
77
commands:
88
- R CMD build .
9-
- set -e; R CMD check *.tar.gz >&1 | tee stdfile && cat stdfile | (grep -E "(WARNING)" > /dev/null) && exit 1 || exit 0
9+
- set -e; R CMD check *.tar.gz >&1 | tee stdfile && cat stdfile | (grep -E "(WARNING|ERROR)" > /dev/null) && exit 1 || exit 0
1010

1111
- name: coverage
1212
image: brazildatacube/r-webservices:1.0.0

R/assets_download.R

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,12 @@
4343
#' the link of the item pointing to the directory where the assets were saved.
4444
#'
4545
#' @export
46-
assets_download <- function(items, assets_name, output_dir = ".",
47-
overwrite = FALSE, items_max = Inf, progress = TRUE,
46+
assets_download <- function(items,
47+
assets_name,
48+
output_dir = ".",
49+
overwrite = FALSE,
50+
items_max = Inf,
51+
progress = TRUE,
4852
...) {
4953

5054
#check the object subclass
@@ -95,8 +99,9 @@ assets_download <- function(items, assets_name, output_dir = ".",
9599
utils::setTxtProgressBar(pb, i)
96100

97101
items$features[[i]] <- .item_download(items$features[[i]],
98-
assets_name, output_dir,
99-
overwrite,...)
102+
assets_name,
103+
output_dir,
104+
overwrite, ...)
100105
}
101106
# close progress bar
102107
if (progress)
@@ -173,6 +178,9 @@ assets_download <- function(items, assets_name, output_dir = ".",
173178
#' @noRd
174179
.file_ext <- function(asset_url) {
175180

181+
# remove query string from url
182+
asset_url[[1]] <- sub("\\?.+", "", asset_url[[1]])
183+
176184
pos <- regexpr("\\.([[:alnum:]]+)$", asset_url[[1]])
177185
if (pos < 0) return("")
178186
return(substring(asset_url[[1]], pos + 1))

0 commit comments

Comments
 (0)