summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_external/lib/sftp.php6
-rw-r--r--tests/lib/files/storage/storage.php7
2 files changed, 12 insertions, 1 deletions
diff --git a/apps/files_external/lib/sftp.php b/apps/files_external/lib/sftp.php
index c457a87a6c7..cbe090311a9 100644
--- a/apps/files_external/lib/sftp.php
+++ b/apps/files_external/lib/sftp.php
@@ -251,7 +251,11 @@ class SFTP extends \OC\Files\Storage\Common {
*/
public function rmdir($path) {
try {
- return $this->getConnection()->delete($this->absPath($path), true);
+ $result = $this->getConnection()->delete($this->absPath($path), true);
+ // workaround: stray stat cache entry when deleting empty folders
+ // see https://github.com/phpseclib/phpseclib/issues/706
+ $this->getConnection()->clearStatCache();
+ return $result;
} catch (\Exception $e) {
return false;
}
diff --git a/tests/lib/files/storage/storage.php b/tests/lib/files/storage/storage.php
index 2355009c9bf..fcd7f73dcde 100644
--- a/tests/lib/files/storage/storage.php
+++ b/tests/lib/files/storage/storage.php
@@ -380,6 +380,13 @@ abstract class Storage extends \Test\TestCase {
$this->assertFalse($this->instance->file_exists('folder'));
}
+ public function testRmdirEmptyFolder() {
+ $this->assertTrue($this->instance->mkdir('empty'));
+ $this->wait();
+ $this->assertTrue($this->instance->rmdir('empty'));
+ $this->assertFalse($this->instance->file_exists('empty'));
+ }
+
public function testRecursiveUnlink() {
$this->instance->mkdir('folder');
$this->instance->mkdir('folder/bar');