summaryrefslogtreecommitdiffstats
path: root/lib/private/Files/View.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2017-02-08 15:56:34 +0100
committerMorris Jobke <hey@morrisjobke.de>2017-03-16 23:45:03 -0600
commit7256940524de24dc754678401e1902848bb5b175 (patch)
treef15246621756b3c19f34b686a2cdd05939da4c2f /lib/private/Files/View.php
parent5683365a2cc605cbaf41290e4cdfde7028f9014a (diff)
downloadnextcloud-server-7256940524de24dc754678401e1902848bb5b175.tar.gz
nextcloud-server-7256940524de24dc754678401e1902848bb5b175.zip
Redirect unlink to rmdir (#27101)
Many API callers will call unlink even for directories and it can mess up with some wrappers like the encryption wrapper Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib/private/Files/View.php')
-rw-r--r--lib/private/Files/View.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index db21d400b39..6ffb5edff3e 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -692,7 +692,11 @@ class View {
if ($mount and $mount->getInternalPath($absolutePath) === '') {
return $this->removeMount($mount, $absolutePath);
}
- $result = $this->basicOperation('unlink', $path, array('delete'));
+ if ($this->is_dir($path)) {
+ $result = $this->basicOperation('rmdir', $path, ['delete']);
+ } else {
+ $result = $this->basicOperation('unlink', $path, ['delete']);
+ }
if (!$result && !$this->file_exists($path)) { //clear ghost files from the cache on delete
$storage = $mount->getStorage();
$internalPath = $mount->getInternalPath($absolutePath);