aliyun / aliyun-oss-php-sdk-flysystem

Flysystem Adapter for AliCloud OSS
MIT License
43 stars 6 forks source link

listContents() when recursive = false doesn't work as expected #1

Closed phoenixgao closed 6 years ago

phoenixgao commented 6 years ago

listContents() only works for root dir But on sub dirs it only return one prefixList which is it self

for example if I have /upload/0/0/0/.jpg /upload/0/0/1/.jpg /upload/0/1/0/*.jpg ...

When calling listContents("upload/0/") the tail slash will be trimmed, it will call oss client get "upload/0" the return data contains no dirs and no files, only itself in prefixList

Recursive = true works fine

Please check.

RobertYue19900425 commented 6 years ago

thank you, i wiil check.

phoenixgao commented 6 years ago

@RobertYue19900425 Thank you. Also I just found the test passes but I don't get why in the test it expects 0

https://github.com/aliyun/aliyun-oss-php-sdk-flysystem/blob/master/tests/AliyunOssAdapterTest.php#L290

or I misunderstood this API?

$this->filesystem->write($dir . '/1.txt', '123');
$this->filesystem->write($dir . '/2.txt', '123');
$this->filesystem->write($dir . '/3.txt', '123');
$this->filesystem->write($dir . '/secondlevel/4.txt', '123');

In this case with recursive I would expect count to be 5: 4 files and one dir "secondlevel"

without recursive I would expect it return 3 files and the subdir "secondlevel"

Shouldn't it be this case?

RobertYue19900425 commented 6 years ago

It's a bug and my test case is wrong when recursive is false

without recursive it will return 3 files and the subdir

with recursive it will only return 4 files

I will fix it later

RobertYue19900425 commented 6 years ago

done. pls help check.

phoenixgao commented 6 years ago

@RobertYue19900425 dev-master works fine for me, so I'm going to close this issue. Thanks for the quick fix!

But tag 1.2.1 seems has not been synced to packagist yet, maybe the webhook was not setup properly or you might need manually update.