Skip to content

Commit 5737ef0

Browse files
committed
windows path fixes
1 parent 9780b95 commit 5737ef0

7 files changed

Lines changed: 27 additions & 6 deletions

File tree

diskover-web/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Diskover-web v2 Community Edition Change Log
22

3+
# [2.2.1] - 2023-10-17
4+
### fixed
5+
- Windows issues
6+
7+
38
# [2.2.0] - 2023-10-07
49
### fixed
510
- slow logins when indexing

diskover-web/public/d3_inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function get_dir_info($client, $index, $path) {
5959
]
6060
];
6161
} else {
62-
$p = escape_chars(dirname($path));
62+
$p = escape_chars(getDirName($path));
6363
$f = escape_chars(basename($path));
6464
$searchParams['body'] = [
6565
'size' => 1,

diskover-web/public/results.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
$splitpath = explode('/', $path);
137137
$x = substr_count($_SESSION['rootpath'], '/');
138138
$splitpath = array_slice($splitpath, $x);
139-
$pathfull = dirname($_SESSION['rootpath']);
139+
$pathfull = getDirName($_SESSION['rootpath']);
140140
if ($pathfull == '/') $pathfull = '';
141141
$n = 0;
142142
foreach ($splitpath as $pathitem) {

diskover-web/src/diskover/Diskover.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ function setRootPath($p) {
557557
function getRootPath($p)
558558
{
559559
if ($p == $_SESSION['toppath']) return $p;
560-
$p = dirname($p);
560+
$p = getDirName($p);
561561
if ($p == '/') return $p;
562562
if ($p != '' && $p != '.') {
563563
return getRootPath($p);
@@ -566,6 +566,17 @@ function getRootPath($p)
566566
}
567567

568568

569+
// return parent directory path and handle Windows backslash
570+
function getDirName($path)
571+
{
572+
$p = dirname($path);
573+
if ($p == '/' || $p == '\\') {
574+
return '/';
575+
}
576+
return $p;
577+
}
578+
579+
569580
// remove index from globals and session vars
570581
function removeIndex($index, $uuid = null)
571582
{
@@ -906,7 +917,7 @@ function changePercent($a, $b)
906917
function getParentDir($p)
907918
{
908919
if (strlen($p) > strlen($_SESSION['rootpath'])) {
909-
return dirname($p);
920+
return getDirName($p);
910921
} else {
911922
return $_SESSION['rootpath'];
912923
}

diskover-web/src/diskover/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
*/
1818

1919
// diskover-web version
20-
$VERSION = '2.2.0 community edition (ce)';
20+
$VERSION = '2.2.1 community edition (ce)';

diskover/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Diskover v2 Community Edition Change Log
22

3+
# [2.2.1] - 2023-10-17
4+
### changed
5+
- version change only
6+
7+
38
# [2.2.0] - 2023-10-07
49
### fixed
510
- python error when scanning file/directory with invalid future timestamps causing scan to exit with critical error

diskover/diskover.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
get_file_name, load_plugins, list_plugins, get_plugins_info, set_times, \
4343
get_mem_usage, get_win_path, rem_win_path
4444

45-
version = '2.2.0 community edition (ce)'
45+
version = '2.2.1 community edition (ce)'
4646
__version__ = version
4747

4848
# Windows check

0 commit comments

Comments
 (0)