ensure content-length is never exponential notation

This commit is contained in:
hong-revo 2018-11-09 14:46:44 +11:00
Родитель c233eed700
Коммит 7811a1a536
2 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -253,7 +253,8 @@ upload_blob <- function(container, src, dest, type="BlockBlob", blocksize=2^24,
if(thisblock == 0) if(thisblock == 0)
break break
headers[["content-length"]] <- thisblock # ensure content-length is never exponential notation
headers[["content-length"]] <- sprintf("%.0f", thisblock)
id <- openssl::base64_encode(sprintf("%s-%010d", dest, i)) id <- openssl::base64_encode(sprintf("%s-%010d", dest, i))
opts <- list(comp="block", blockid=id) opts <- list(comp="block", blockid=id)

Просмотреть файл

@ -215,8 +215,9 @@ upload_azure_file <- function(share, src, dest, blocksize=2^24)
on.exit(close(con)) on.exit(close(con))
# first, create the file # first, create the file
# ensure content-length is never exponential notation
headers <- list("x-ms-type"="file", headers <- list("x-ms-type"="file",
"x-ms-content-length"=nbytes) "x-ms-content-length"=sprintf("%.0f", nbytes))
do_container_op(share, dest, headers=headers, http_verb="PUT") do_container_op(share, dest, headers=headers, http_verb="PUT")
# then write the bytes into it, one block at a time # then write the bytes into it, one block at a time
@ -233,7 +234,8 @@ upload_azure_file <- function(share, src, dest, blocksize=2^24)
if(thisblock == 0) # sanity check if(thisblock == 0) # sanity check
break break
headers[["content-length"]] <- thisblock # ensure content-length is never exponential notation
headers[["content-length"]] <- sprintf("%.0f", thisblock)
headers[["range"]] <- sprintf("bytes=%s-%s", range_begin, range_begin + thisblock - 1) headers[["range"]] <- sprintf("bytes=%s-%s", range_begin, range_begin + thisblock - 1)
do_container_op(share, dest, headers=headers, body=body, options=options, http_verb="PUT") do_container_op(share, dest, headers=headers, body=body, options=options, http_verb="PUT")