使用共享访问签名下载 Azure blob 失败,出现 curl 或 httr

Downloading Azure blob using shared access signature fails with curl or httr

在使用 curl::curl_downloadhttr::GET 之前,我已经设法从 blob 存储下载,但这次失败并出现 400 错误。但是,如果我使用基数 R 的 download.file,它会起作用。

下载 URL 是(逐字复制,但省略了文件详细信息和实际签名):

https://{account}.blob.core.windows.net/{store}/{file.zip}?sp=r&st=2018-05-19T00:00:00Z&se=2018-05-31T00:00:00Z&spr=https&sv=2017-07-29&sig={...}&sr=b

其中 SAS 部分是

sp=r&st=2018-05-19T00:00:00Z&se=2018-05-31T00:00:00Z&spr=https&sv=2017-07-29&sig={...}&sr=b

还有其他人遇到过这个问题吗?

事实证明,它与 SAS 无关。文件名中有一个 space,Windows 上的默认 download.file 变成 %20,但 curl 没有。将 space 手动编码为 %20 解决了问题。