Skip to content

Commit

Permalink
windows path fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shirosaidev committed Oct 18, 2023
1 parent 9780b95 commit 5737ef0
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 6 deletions.
5 changes: 5 additions & 0 deletions diskover-web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Diskover-web v2 Community Edition Change Log

# [2.2.1] - 2023-10-17
### fixed
- Windows issues


# [2.2.0] - 2023-10-07
### fixed
- slow logins when indexing
Expand Down
2 changes: 1 addition & 1 deletion diskover-web/public/d3_inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function get_dir_info($client, $index, $path) {
]
];
} else {
$p = escape_chars(dirname($path));
$p = escape_chars(getDirName($path));
$f = escape_chars(basename($path));
$searchParams['body'] = [
'size' => 1,
Expand Down
2 changes: 1 addition & 1 deletion diskover-web/public/results.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
$splitpath = explode('/', $path);
$x = substr_count($_SESSION['rootpath'], '/');
$splitpath = array_slice($splitpath, $x);
$pathfull = dirname($_SESSION['rootpath']);
$pathfull = getDirName($_SESSION['rootpath']);
if ($pathfull == '/') $pathfull = '';
$n = 0;
foreach ($splitpath as $pathitem) {
Expand Down
15 changes: 13 additions & 2 deletions diskover-web/src/diskover/Diskover.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ function setRootPath($p) {
function getRootPath($p)
{
if ($p == $_SESSION['toppath']) return $p;
$p = dirname($p);
$p = getDirName($p);
if ($p == '/') return $p;
if ($p != '' && $p != '.') {
return getRootPath($p);
Expand All @@ -566,6 +566,17 @@ function getRootPath($p)
}


// return parent directory path and handle Windows backslash
function getDirName($path)
{
$p = dirname($path);
if ($p == '/' || $p == '\\') {
return '/';
}
return $p;
}


// remove index from globals and session vars
function removeIndex($index, $uuid = null)
{
Expand Down Expand Up @@ -906,7 +917,7 @@ function changePercent($a, $b)
function getParentDir($p)
{
if (strlen($p) > strlen($_SESSION['rootpath'])) {
return dirname($p);
return getDirName($p);
} else {
return $_SESSION['rootpath'];
}
Expand Down
2 changes: 1 addition & 1 deletion diskover-web/src/diskover/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
*/

// diskover-web version
$VERSION = '2.2.0 community edition (ce)';
$VERSION = '2.2.1 community edition (ce)';
5 changes: 5 additions & 0 deletions diskover/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Diskover v2 Community Edition Change Log

# [2.2.1] - 2023-10-17
### changed
- version change only


# [2.2.0] - 2023-10-07
### fixed
- python error when scanning file/directory with invalid future timestamps causing scan to exit with critical error
Expand Down
2 changes: 1 addition & 1 deletion diskover/diskover.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
get_file_name, load_plugins, list_plugins, get_plugins_info, set_times, \
get_mem_usage, get_win_path, rem_win_path

version = '2.2.0 community edition (ce)'
version = '2.2.1 community edition (ce)'
__version__ = version

# Windows check
Expand Down

0 comments on commit 5737ef0

Please sign in to comment.