简体   繁体   English

Rackspace CloudFiles:检查文件是否存在

[英]Rackspace CloudFiles: Check for the existence of a file

I want to check for the existence of a file on the CDN through my site's code via the Rackspace Cloud API. 我想通过Rackspace Cloud API通过我的站点代码检查CDN上是否存在文件。

What would the best way to do this be? 最好的方法是什么? I am currently using the following: 我目前正在使用以下内容:

... initialize API ... 

Dim containerItemList As List(Of String) = connection.GetContainerItemList("MyCDN") 

If containerItemList.Contains(MyFile) Then 
  'Blah blah 
End If 

This isn't working for some reason - the containerItemList is always empty. 由于某些原因,此方法不起作用-containerItemList始终为空。 My container definitely has objects, and the name of the container is right (including case). 我的容器中肯定有对象,并且容器的名称正确(包括大小写)。

Is there a better/different way to search/check for the existence of a file? 有没有更好/不同的方法来搜索/检查文件的存在? Ideally, it should be a case-insensitive search. 理想情况下,它应该是不区分大小写的搜索。

Another way would be to try and get the object using something like connection.GetStorageItem, and check for exceptions, but obviously that would hurt performance. 另一种方法是尝试使用诸如connection.GetStorageItem之类的对象来获取对象,并检查异常,但这显然会损害性能。

Any ideas? 有任何想法吗? Code in any language would be fine, I'm just looking for the best way to do this. 任何语言的代码都可以,我只是在寻找实现此目的的最佳方法。

Thanks in advance! 提前致谢!

WT WT

这似乎是一个错误,已由社区成员修复: https : //github.com/rackspace/csharp-cloudfiles/issues/unreads#issue/6

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM