From c41559dee4e8da73b63a202eff7930c7124b8bea Mon Sep 17 00:00:00 2001 From: Maximilian Ruta Date: Thu, 17 Oct 2019 21:56:33 +0200 Subject: [PATCH] Fix bug that creates duplicate folders with same name --- src/GoogleDriveAdapter.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/GoogleDriveAdapter.php b/src/GoogleDriveAdapter.php index 7e40833..35f6a54 100644 --- a/src/GoogleDriveAdapter.php +++ b/src/GoogleDriveAdapter.php @@ -473,6 +473,20 @@ public function deleteDir($dirname) */ public function createDir($dirname, Config $config, $internalCall = false) { + try { + $meta = $this->getMetadata($dirname); + } catch (FileNotFoundException $e) { + $meta = false; + } + + if ($meta !== false) { + return [ + 'path' => $meta['path'], + 'filename' => $meta['filename'], + 'extension' => $meta['extension'] + ]; + } + list($pdir, $name) = $this->splitPath($dirname, false); if($this->useDisplayPaths) { if($pdir !== $this->root) {