summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-03-24 15:51:12 +0100
committerLukas Reschke <lukas@owncloud.com>2015-03-24 15:51:12 +0100
commit5a9c9b86f81806a6b67bf16385eef48296a62586 (patch)
tree3408a57d4dae82099d255fc2824348a209c29dae /lib/private
parent5e9e2b700d02259b39d443493cb8f69a8bd47304 (diff)
parentd11f01fa0f2228bb36e7b1a46cd80cec8bf1baac (diff)
downloadnextcloud-server-5a9c9b86f81806a6b67bf16385eef48296a62586.tar.gz
nextcloud-server-5a9c9b86f81806a6b67bf16385eef48296a62586.zip
Merge pull request #15153 from owncloud/uniquename-node
Add `getNonExistingName()` to the node api
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/files/node/folder.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/private/files/node/folder.php b/lib/private/files/node/folder.php
index 5fd73cc5d36..18a93913f06 100644
--- a/lib/private/files/node/folder.php
+++ b/lib/private/files/node/folder.php
@@ -389,4 +389,16 @@ class Folder extends Node implements \OCP\Files\Folder {
throw new NotPermittedException();
}
}
+
+ /**
+ * Add a suffix to the name in case the file exists
+ *
+ * @param string $name
+ * @return string
+ * @throws NotPermittedException
+ */
+ public function getNonExistingName($name) {
+ $uniqueName = \OC_Helper::buildNotExistingFileNameForView($this->getPath(), $name, $this->view);
+ return trim($this->getRelativePath($uniqueName), '/');
+ }
}