From c5af314193c064a81d1abb2e564f21fedca51bad Mon Sep 17 00:00:00 2001 From: mrv777 Date: Tue, 30 Jun 2026 12:21:33 -0500 Subject: [PATCH 1/2] fix: guard against wiping raid array and over-removing file shares - raid: throw in setup() if an array already exists, so the dev/testing setup route can't repartition and destroy a live pool. - files: only remove shares for the deleted path or its children, not siblings. deleting /External/Drive/Foo was also removing the share for /External/Drive/Foobar. --- packages/umbreld/source/modules/files/files.ts | 3 ++- packages/umbreld/source/modules/hardware/raid.ts | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/umbreld/source/modules/files/files.ts b/packages/umbreld/source/modules/files/files.ts index dbb4dbf9d..942d2ae04 100644 --- a/packages/umbreld/source/modules/files/files.ts +++ b/packages/umbreld/source/modules/files/files.ts @@ -692,7 +692,8 @@ export default class Files { if (virtualPath.startsWith('/External/')) { const shares = (await this.#umbreld.store.get('files.shares')) || [] for (const share of shares) { - if (share.path.startsWith(virtualPath)) await this.samba.removeShare(share.path) + if (share.path === virtualPath || share.path.startsWith(`${virtualPath}/`)) + await this.samba.removeShare(share.path) } } diff --git a/packages/umbreld/source/modules/hardware/raid.ts b/packages/umbreld/source/modules/hardware/raid.ts index 62d117e6c..fc2d824fa 100644 --- a/packages/umbreld/source/modules/hardware/raid.ts +++ b/packages/umbreld/source/modules/hardware/raid.ts @@ -923,6 +923,10 @@ export default class Raid { if (deviceIds.length === 0) throw new Error('At least one device is required') if (raidType === 'failsafe' && deviceIds.length < 2) throw new Error('Failsafe mode requires at least two devices') + // Don't wipe an existing array. setup() partitions the devices and creates a + // fresh pool, so running it again would destroy the live array. + if ((await this.getStatus()).exists) throw new Error('A RAID array already exists') + const devices = deviceIds.map((id) => `/dev/disk/by-umbrel-id/${id}`) for (const device of devices) { if (!(await fse.pathExists(device))) throw new Error(`Device not found: ${device}`) From ae0d66bab903f1bb489b35093bb172f77206564b Mon Sep 17 00:00:00 2001 From: mrv777 Date: Tue, 30 Jun 2026 12:27:55 -0500 Subject: [PATCH 2/2] fix: normalize path in delete so share cleanup handles trailing slashes delete() used the raw path for the /External share check, so a trailing slash (e.g. /External/Drive/Folder/) skipped child shares. normalize up front like list() does. --- packages/umbreld/source/modules/files/files.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/umbreld/source/modules/files/files.ts b/packages/umbreld/source/modules/files/files.ts index 942d2ae04..68b59c4d5 100644 --- a/packages/umbreld/source/modules/files/files.ts +++ b/packages/umbreld/source/modules/files/files.ts @@ -680,6 +680,8 @@ export default class Files { // Permanently delete a file or directory async delete(virtualPath: string) { + virtualPath = normalizePath(virtualPath) + // Check if operation is allowed const allowedOperations = await this.getAllowedOperations(virtualPath) if (!allowedOperations.includes('delete')) throw new Error('[operation-not-allowed]')