Skip to content

Commit

Permalink
Make sure that a empty directory can still be deleted when copied fro…
Browse files Browse the repository at this point in the history
…m another storage

Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Nov 17, 2020
1 parent 62c0009 commit 7129f2c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/private/Files/Storage/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $t
$dh = $sourceStorage->opendir($sourceInternalPath);
$result = $this->mkdir($targetInternalPath);
if (is_resource($dh)) {
$result = true;

This comment has been minimized.

Copy link
@rullzer

rullzer Nov 17, 2020

Member

this seems very weird in common...
shouldn't mkdir then just return true on S3?

This comment has been minimized.

Copy link
@juliusknorr

juliusknorr Nov 17, 2020

Author Member

Target would be the trash bin storage in the case, but valid point. I'll investigate further to see why that is not the case actually.

This comment has been minimized.

Copy link
@juliusknorr

juliusknorr Nov 17, 2020

Author Member

So the issue here is that the cache entry has already been moved through

$trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);

Therefore the mkdir fail is expected since the node is already in place. I need to debug this a bit more with different setups without primary object storage to see how this behaves.

Maybe @icewind1991 has an idea how to solve that anyways 😉

while ($result and ($file = readdir($dh)) !== false) {
if (!Filesystem::isIgnoredDir($file)) {
$result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath . '/' . $file, $targetInternalPath . '/' . $file);
Expand Down

0 comments on commit 7129f2c

Please sign in to comment.