Coder Social home page Coder Social logo

Comments (4)

overtrue avatar overtrue commented on July 18, 2024

我试试

from flysystem-cos.

eslizn avatar eslizn commented on July 18, 2024

补充一下:
1.listObjects理应带出目录(CommonPrefixes),但是没有
2.当bucket或者目录下只存在一个文件或者一个目录时,对应的Contents或者CommonPrefixes都为一维数组

CosAdapter.php:183

$response = $this->listObjects($this->applyPathPrefix($directory), $recursive);
dd($response);

//应追加目录
foreach ($response['CommonPrefixes'] ?? [] as $prefix) {
	$list[] = $this->normalizeFileInfo([
		'Key' => $prefix['Prefix'],
		'Size' => 0,
		'LastModified' => 0,
	]);
}

正常情况

array:8 [
  "Name" => "***"
  "Prefix" => []
  "Marker" => []
  "MaxKeys" => "1000"
  "Delimiter" => "/"
  "IsTruncated" => "false"
  "CommonPrefixes" => array:3 [
    0 => array:1 [
      "Prefix" => "test/"
    ]
    1 => array:1 [
      "Prefix" => "users/"
    ]
    2 => array:1 [
      "Prefix" => "usr/"
    ]
  ]
  "Contents" => array:2 [
    0 => array:6 [
      "Key" => "main.hpp"
      "LastModified" => "2021-03-01T15:01:25.000Z"
      "ETag" => ""d9351288f15ab698f500dcfde0334d08""
      "Size" => "2634"
      "Owner" => array:2 [
        "ID" => "1251114936"
        "DisplayName" => "1251114936"
      ]
      "StorageClass" => "STANDARD"
    ]
    1 => array:6 [
      "Key" => "t.sql"
      "LastModified" => "2021-03-01T14:23:45.000Z"
      "ETag" => ""413921e8eff9a594359755d4d99c4117""
      "Size" => "156"
      "Owner" => array:2 [
        "ID" => "1251114936"
        "DisplayName" => "1251114936"
      ]
      "StorageClass" => "STANDARD"
    ]
  ]
]

异常情况

array:8 [
  "Name" => "***"
  "Prefix" => "usr/"
  "Marker" => []
  "MaxKeys" => "1000"
  "Delimiter" => "/"
  "IsTruncated" => "false"
  "CommonPrefixes" => array:1 [
    "Prefix" => "usr/uploads/"
  ]
  "Contents" => array:6 [
    "Key" => "usr/"
    "LastModified" => "2019-02-28T09:03:33.000Z"
    "ETag" => ""d41d8cd98f00b204e9800998ecf8427e""
    "Size" => "0"
    "Owner" => array:2 [
      "ID" => "1251114936"
      "DisplayName" => "1251114936"
    ]
    "StorageClass" => "STANDARD"
  ]
]

from flysystem-cos.

overtrue avatar overtrue commented on July 18, 2024

listObjects理应带出目录(CommonPrefixes),但是没有

麻烦给我一下 #16 (comment) 的文件结构看看(多文件时)

from flysystem-cos.

eslizn avatar eslizn commented on July 18, 2024

listObjects理应带出目录(CommonPrefixes),但是没有

麻烦给我一下 #16 (comment) 的文件结构看看(多文件时)

上面贴的正常情况就是

array:8 [
  "Name" => "***"
  "Prefix" => []
  "Marker" => []
  "MaxKeys" => "1000"
  "Delimiter" => "/"
  "IsTruncated" => "false"
  "CommonPrefixes" => array:3 [
    0 => array:1 [
      "Prefix" => "test/"
    ]
    1 => array:1 [
      "Prefix" => "users/"
    ]
    2 => array:1 [
      "Prefix" => "usr/"
    ]
  ]
  "Contents" => array:2 [
    0 => array:6 [
      "Key" => "main.hpp"
      "LastModified" => "2021-03-01T15:01:25.000Z"
      "ETag" => ""d9351288f15ab698f500dcfde0334d08""
      "Size" => "2634"
      "Owner" => array:2 [
        "ID" => "1251114936"
        "DisplayName" => "1251114936"
      ]
      "StorageClass" => "STANDARD"
    ]
    1 => array:6 [
      "Key" => "t.sql"
      "LastModified" => "2021-03-01T14:23:45.000Z"
      "ETag" => ""413921e8eff9a594359755d4d99c4117""
      "Size" => "156"
      "Owner" => array:2 [
        "ID" => "1251114936"
        "DisplayName" => "1251114936"
      ]
      "StorageClass" => "STANDARD"
    ]
  ]
]

from flysystem-cos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.