fix(media): refuse local disk when a NAS share is configured
CI / build (push) Has been cancelled

A bind-mounted host directory made the app report storage as ready while
media landed on the container host's local filesystem, so the NFS export was
never actually used. mediaStorage() now reads the mount table: a share written
as host:/export is only accepted when the media root is on a network
filesystem, otherwise uploads, edits and filing are blocked with the real
device and the fix. Settings and the Media page show the detected filesystem
and host-mount steps, README section 9 documents the OS-level mount (including
Docker-in-LXC) with docker-compose.nfs.yml as the alternative, and the E2E
suites use path-style shares for local test directories.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
2026-11-21 00:45:36 +00:00
parent 2fc71883d7
commit 982f9048e1
14 changed files with 439 additions and 33 deletions
+26 -3
View File
@@ -167,17 +167,40 @@ test.describe("growth goals and maintenance", () => {
"Photo and video uploads are disabled",
);
// Leave a working destination behind for the specs that upload media.
const restored = await page.request.put(`${BASE}/api/dev/storage`, {
// A share name that reads like `host:/export` while the path is a local
// directory must block writes: media would silently land on local disk.
const mismatched = await page.request.put(`${BASE}/api/dev/storage`, {
data: {
nfsShare: "e2e-nas:/export/church",
archivePath: archiveRoot,
archiveFolder: "E2E Gate",
},
});
expect(mismatched.ok()).toBe(true);
const blockedAgain = await page.request.post(
`${BASE}/api/events/${eventId}/folders/${folderId}/photos?name=still-blocked.jpg`,
{
headers: { "content-type": "image/jpeg" },
data: Buffer.from([0xff, 0xd8, 0xff, 0xd9]),
},
);
expect(blockedAgain.status()).toBe(503);
expect(((await blockedAgain.json()) as { error: string }).error).toContain(
"not a network mount",
);
// Leave a working local-path destination behind for the specs that upload
// media; a path-style share is allowed to live on local disk.
const restored = await page.request.put(`${BASE}/api/dev/storage`, {
data: {
nfsShare: archiveRoot,
archivePath: archiveRoot,
archiveFolder: "E2E Archive",
},
});
expect(restored.ok()).toBe(true);
// With a usable share the Media page reports the archive's usage.
// With a usable local path the Media page reports the storage usage.
await page.goto(`${BASE}/media`);
await expect(
page.getByText("Original media storage", { exact: true }),
+3 -1
View File
@@ -86,7 +86,9 @@ test.describe("media library and video sharing", () => {
const configured = await page.request.put(`${BASE}/api/dev/storage`, {
data: {
nfsShare: "e2e-nas:/export/church",
// Path-style share: this suite writes to a local E2E directory. A
// NAS-style share name would (correctly) demand a real network mount.
nfsShare: ARCHIVE_ROOT,
archivePath: ARCHIVE_ROOT,
archiveFolder: ARCHIVE_FOLDER,
},
+3 -1
View File
@@ -49,7 +49,9 @@ test("exports a delivery size, then archives and removes the event", async ({
const configured = await page.request.put(`${BASE}/api/dev/storage`, {
data: {
nfsShare: "e2e-nas:/export/church",
// Path-style share: this suite writes to a local E2E directory. A
// NAS-style share name would (correctly) demand a real network mount.
nfsShare: ARCHIVE_ROOT,
archivePath: ARCHIVE_ROOT,
archiveFolder: ARCHIVE_FOLDER,
},