fix delete recursion bug for realz
Mwebclient/src/offline.ts
@@ -152,6 +152,7 @@ function getDirInTree(path: string, create: boolean, offline: boolean): Director
}
function deleteInOfflineTree(path: string): void {
if (path === "") return;
const basePath = path.split("/").slice(0, -1).join("/");
const fileName = path.split("/").toReversed()[0];
@@ -159,6 +160,7 @@ function deleteInOfflineTree(path: string): void {
if (!node) return;
node.files.delete(fileName);
if (node.files.size === 0) deleteInOfflineTree(basePath);
}
export const clearDirectoryCache = (path: string) => {