Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Media library does not show folder contents properly on windows because of different directory separator https://github.com/givanz/Vvveb/issues/90

givanzc0e5ac45f0d0
diff --git a/admin/controller/media/media.php b/admin/controller/media/media.php
index bba6c0e..e1f5caa 100755
--- a/admin/controller/media/media.php
+++ b/admin/controller/media/media.php
@@ -182,8 +182,8 @@ class Media extends Base {
$files[] = [
'name' => $f,
'type' => 'folder',
- 'path' => str_replace($scandir, '', $dir) . DS . $f,
- 'items' => $scan($dir . DS . $f), // Recursively get the contents of the folder
+ 'path' => str_replace([$scandir, '\\'], ['', '/'], $dir) . '/' . $f,
+ 'items' => $scan("$dir/$f"), // Recursively get the contents of the folder
];
} else {
// It is a file
@@ -191,8 +191,8 @@ class Media extends Base {
$files[] = [
'name' => $f,
'type' => 'file',
- 'path' => str_replace($scandir, '', $dir) . DS . $f,
- 'size' => filesize($dir . DS . $f), // Gets the size of this file
+ 'path' => str_replace([$scandir, '\\'], ['', '/'], $dir) . '/' . $f,
+ 'size' => filesize("$dir/$f"), // Gets the size of this file
];
}
}