diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php
index d91654fe24aed6091482a2348d18d487962c7c6b..f8537f10c4abcaee5606a74d0486813772608d2f 100644
--- a/apps/files_versions/lib/versions.php
+++ b/apps/files_versions/lib/versions.php
@@ -569,7 +569,7 @@ class Storage {
 	 * @param \OC\Files\View $view view on data/user/
 	 */
 	private static function createMissingDirectories($filename, $view) {
-		$dirname = \OC_Filesystem::normalizePath(pathinfo($filename, PATHINFO_DIRNAME));
+		$dirname = \OC_Filesystem::normalizePath(dirname($filename));
 		$dirParts = explode('/', $dirname);
 		$dir = "/files_versions";
 		foreach ($dirParts as $part) {