Google cloud storage 文件路径中带有双斜杠的Google云存储

Google cloud storage 文件路径中带有双斜杠的Google云存储,google-cloud-storage,Google Cloud Storage,这个问题花费了我一些时间,因为一些文件似乎消失了。我不确定当(在我的例子中是无意中)一个带有双斜杠的文件被添加到谷歌云存储时,这是否是正确的行为 以下是如何重新创建问题: $ vi test (create a simple file) $ gsutil cp test gs://xxxxx.appspot.com/test/doubleslash//test Copying file://test [Content-Type=application/octet-stream]... Uploa

这个问题花费了我一些时间,因为一些文件似乎消失了。我不确定当(在我的例子中是无意中)一个带有双斜杠的文件被添加到谷歌云存储时,这是否是正确的行为

以下是如何重新创建问题:

$ vi test (create a simple file)
$ gsutil cp test gs://xxxxx.appspot.com/test/doubleslash//test
Copying file://test [Content-Type=application/octet-stream]...
Uploading   gs://xxxxx.appspot.com/test/doubleslash//test:     15 B/15 B
// attempting gsutil ls command with one slash ... only the folder shows    
$ gsutil ls -al gs://xxxxx.appspot.com/test/doubleslash/
                                 gs://xxxxx.appspot.com/test/doubleslash//
// attempting gsutil ls command with two slashes ... only the folder shows    
$ gsutil ls -al gs://xxxxx.appspot.com/test/doubleslash//
                                 gs://xxxxx.appspot.com/test/doubleslash//
$
注意:“测试”文件未显示。但是,如果提供完整的文件路径,则会显示:

$ gsutil ls -al gs://xxxxx.appspot.com/test/doubleslash//test
        15  2015-11-27T17:21:24Z  gs://xxxxx.appspot.com/test/doubleslash//test#1448644884041000  metageneration=1
TOTAL: 1 objects, 15 bytes (15 B)
最后,真正奇怪的是,当将文件添加到单斜杠文件夹(称为testInside)中时,然后使用双斜杠执行“gsutil ls”命令,单斜杠文件夹中的文件会出现,但双斜杠文件夹中的文件不会出现:

$ gsutil cp test gs://xxxxx.appspot.com/test/doubleslash/testInside
Copying file://test [Content-Type=application/octet-stream]...
Uploading   …/xxxxx.appspot.com/test/doubleslash/testInside: 15 B/15 B  
$ gsutil ls -al gs://xxxxx.appspot.com/test/doubleslash//
                                     gs://xxxxx.appspot.com/test/doubleslash//
            15  2015-11-27T20:14:42Z  gs://xxxxx.appspot.com/test/doubleslash/testInside#1448655282555000  metageneration=1
    TOTAL: 1 objects, 15 bytes (15 B)
现在,通过应用程序列出文件夹时,双斜杠文件夹中的文件确实会与单斜杠文件夹中的任何文件一起出现(指定一个斜杠时):

build.gradle:

compile ('com.google.apis:google-api-services-storage:v1-rev54-1.21.0')
Java代码:

Objects response = storageService.objects()
                       .list(“xxxxx.appspot.com")
                       .setPrefix(“test/doubleslash/").execute();

我无法确定双斜杠文件夹中的文件出现在代码中的原因,但不能从gsutil命令行确定。评论?

你好,克雷格。除了“评论”还有什么问题吗?因为如果你对这个问题的唯一意图是揭露行为,谷歌集团可能更适合这样做。堆栈实际上是用于提问和回答,而不是用于突出显示类似内容的帖子。如果您认为这是一个bug,并且希望看到可以对其进行哪些修复,那么问题跟踪器将是合适的站点:干杯!我相信这是一个bug,但如果谷歌想解释它为什么能按设计工作,那么我愿意接受这个解释。这个bug的(可能的)解释、报告和修复都应该在我们的问题跟踪程序上。虽然我们将Stack作为一个支持客户的地方进行宣传,但它并不适合所有主题。我建议把它带到我之前链接的问题追踪者那里,我自己或团队中的某个人会把它捡起来,看看能做些什么:)。干杯对于任何找到这篇文章的人来说,这一行为/错误似乎在四年后仍然存在。