diff options
Diffstat (limited to 'lib/helper.php')
-rw-r--r-- | lib/helper.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/helper.php b/lib/helper.php index 1860a55fc8f..017221cef77 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -636,6 +636,18 @@ class OC_Helper { * @return string */ public static function buildNotExistingFileName($path, $filename) { + $view = \OC\Files\Filesystem::getView(); + return self::buildNotExistingFileNameForView($path, $filename, $view); + } + + /** + * Adds a suffix to the name in case the file exists + * + * @param $path + * @param $filename + * @return string + */ + public static function buildNotExistingFileNameForView($path, $filename, \OC\Files\View $view) { if($path==='/') { $path=''; } @@ -649,7 +661,7 @@ class OC_Helper { $newpath = $path . '/' . $filename; $counter = 2; - while (\OC\Files\Filesystem::file_exists($newpath)) { + while ($view->file_exists($newpath)) { $newname = $name . ' (' . $counter . ')' . $ext; $newpath = $path . '/' . $newname; $counter++; |