编码百分比和Azure BLOB DELETE的问题?

时间:2017-05-09 17:32:56

标签: azure azure-storage-blobs

Azure正在返回404 The specified blob does not exist,我可以毫无问题地浏览到相关文件。实际上,文件路径是由我的脚本从事先调用https://${vault}.blob.core.windows.net/${container}?restype=container&comp=list生成的,因此BLOB绝对存在110%!

然而,DELETE调用返回404(您可以在下面看到我的标题构造以及Azure响应):

S:DELETE











x-ms-date:Tue, 09 May 2017 17:22:27 GMT
x-ms-version:2016-05-31
/myaccount/mycontainer/path/to/my/dir/Some%20File%20B_Foo_Bar%20Dev_1234.docm
S:EBHf8ElRGrAiYAbLTtYa9SqWFJ2eg7F0bebRNGTlLac=
404 The specified blob does not exist.
Date: Tue, 09 May 2017 17:22:22 GMT
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
Content-Length: 215
Content-Type: application/xml
Client-Date: Tue, 09 May 2017 17:22:39 GMT
Client-Peer: 191.235.193.40:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=US/ST=Washington/L=Redmond/O=Microsoft Corporation/OU=Microsoft IT/CN=Microsoft IT SSL SHA2
Client-SSL-Cert-Subject: /CN=*.blob.core.windows.net
Client-SSL-Cipher: ECDHE-RSA-AES256-SHA384
Client-SSL-Socket-Class: IO::Socket::SSL
X-Ms-Request-Id: 5b3ddd1c-0001-00c1-10e8-c80c81000000
X-Ms-Version: 2016-05-31

我使用的是Perl脚本(脚本从容器/列表API中读取XML并删除早于X的内容),直接使用API​​,相关部分是:

for my $data ( $twig->findnodes("//Blob[Properties/Last-Modified < ${then}]")) {
        ### SEND DELETES
        my $filNam=$data->field("Name");
        $hdrs = "/${vault}/${container}/${filNam}";
        my $delURL="https://${vault}.blob.core.windows.net/${container}/$filNam";
        if ($debug) {
        say "DelURL: ".$delURL;
        }
        if (!$nodelete) {
        doHTTP("DELETE",$delURL,
        $hdrs,
        encode('UTF-8',"DELETE\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:${tNow}\nx-ms-version:${azureVersion}\n${hdrs}",Encode::FB_CROAK)
        );
        }
}

仅供参考,这不是我的代码,如果我使用微软的NPM客户端(即azure -vv storage blob delete data .....)我会得到同样的错误。

1 个答案:

答案 0 :(得分:0)

我想我可能找到了答案。

看起来像是一个“功能”(a.k.a. bug)。

看起来百分比需要以25为前缀(例如%20变为%2520)。

https://blogs.msdn.microsoft.com/windowsazurestorage/2012/05/28/character-encoding-issues-related-to-copy-blob-api/