зеркало из https://github.com/Azure/AzureStor.git
allow sas with leading ?
This commit is contained in:
Родитель
d16f860c9f
Коммит
2cee24d801
1
NEWS.md
1
NEWS.md
|
@ -3,6 +3,7 @@
|
|||
- Uploading with ADLS now sets the Content-Type property correctly.
|
||||
- Fixes to support blob/ADLS interoperability, which has just gone GA.
|
||||
- In `list_blobs` and `list_adls_files`, check that a field exists before trying to modify it (works around problem of possibly inconsistent response from the endpoint).
|
||||
- Allow passing a SAS with a leading `?` (as generated by the Azure Portal and Storage Explorer) to the client functions.
|
||||
|
||||
# AzureStor 3.0.0
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ add_token <- function(token, headers, api)
|
|||
add_sas <- function(sas, url)
|
||||
{
|
||||
full_url <- httr::build_url(url)
|
||||
paste0(full_url, if(is.null(url$query)) "?" else "&", sas)
|
||||
paste0(full_url, if(is.null(url$query)) "?" else "&", sub("^\\?", "", sas))
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -295,6 +295,26 @@ test_that("copy from url works",
|
|||
})
|
||||
|
||||
|
||||
test_that("SAS works with and without leading ?",
|
||||
{
|
||||
sas <- stor$get_account_sas(permissions="rl")
|
||||
bl <- stor$get_blob_endpoint()
|
||||
cont <- create_blob_container(bl, "sastesting")
|
||||
upload_blob(cont, "../resources/iris.csv")
|
||||
|
||||
bl_sas <- blob_endpoint(bl$url, sas=sas)
|
||||
cont_sas <- blob_container(bl_sas, "sastesting")
|
||||
expect_false(is.null(cont_sas$endpoint$sas))
|
||||
expect_is(list_blobs(cont_sas), "data.frame")
|
||||
|
||||
sas2 <- paste0("?", sas)
|
||||
bl_sas2 <- blob_endpoint(bl$url, sas=sas2)
|
||||
cont_sas2 <- blob_container(bl_sas2, "sastesting")
|
||||
expect_false(is.null(cont_sas2$endpoint$sas) && substr(cont_sas2$endpoint$sas, 1, 1) == "?")
|
||||
expect_is(list_blobs(cont_sas2), "data.frame")
|
||||
})
|
||||
|
||||
|
||||
teardown(
|
||||
{
|
||||
bl <- stor$get_blob_endpoint()
|
||||
|
|
Загрузка…
Ссылка в новой задаче