Fixup deletePath. Handle links, and report failures. Fix escaping the filename and put it in quotes in case it has spaces. Fixes #4446

This commit is contained in:
Isaac Connor committed 2025-10-03 16:11:55 -04:00
1 parent 8f475faf12
commit fdfe87be38
1 file changed
+9 -3
+9 -3
View File
@@ -362,10 +362,16 @@ function getEventDefaultVideoPath($event) {
function deletePath( $path ) {
ZM\Debug('Deleting '.$path);
if (is_dir($path)) {
system(escapeshellcmd('rm -rf '.$path));
if (is_link($path)) {
if (!unlink($path)) ZM\Debug("Failed to unlink $path");
} else if (is_dir($path)) {
if (false === ($output = system('rm -rf "'.escapeshellcmd($path).'"'))) {
ZM\Warning('Failed doing rm -rf "'.escapeshellcmd($path).'"');
}
} else if (file_exists($path)) {
unlink($path);
if (!unlink($path)) ZM\Debug("Failed to delete $path");
} else {
ZM\Warning("Path $path does not exist in deletePath()");
}
}