From 6a0cb8cc84ad2cf9bf17d008823d07e5958c6e0a Mon Sep 17 00:00:00 2001 From: Agando Date: Fri, 2 Oct 2026 21:25:46 +0200 Subject: newOS4 v4.6.18: nginx dav trailing-slash semantics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Discovered by dav-health-check.sh E2E (10/10 pass now): - nginx dav module REQUIRES trailing slash on MKCOL (no-slash → 409) and on directory DELETE (no-slash → 409/404); existing dir + slash MKCOL → 405 (the real 'already exists' signal) - _normalizeRemotePath now PRESERVES trailing slashes (collection ops) - _ensureDir MKCOLs with trailing slash - _deleteFile retries with slash on 409/404 (collection delete) - health-check expectations corrected (405 = existing, slash required) --- scripts/test-webdav-paths.mjs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'scripts/test-webdav-paths.mjs') diff --git a/scripts/test-webdav-paths.mjs b/scripts/test-webdav-paths.mjs index a8340c0..d75f9f6 100644 --- a/scripts/test-webdav-paths.mjs +++ b/scripts/test-webdav-paths.mjs @@ -57,7 +57,7 @@ function check(name, cond, got) { // relative + traversal + dupes: ['./a//b/../c.txt', '/a/c.txt'], ['/a/b/../../d.txt', '/d.txt'], - ['/skills/', '/skills'], + ['/skills/', '/skills/'], // trailing slash PRESERVED (nginx dav collection ops need it) ['backups', '/backups'], // foreign space stays intact (only own space prefix is stripped): ['/spaces/otheruser/file.txt', '/spaces/otheruser/file.txt'], @@ -90,8 +90,8 @@ function check(name, cond, got) { }; m._listDir = async () => { throw new Error('ENOENT'); }; await m._ensureDir('https://webx11.duckdns.org/spaces/mindtech/thaimassage-kiefersfelden'); - check('_ensureDir MKCOLs normalized path (no https:/ junk)', - mkcols.length === 1 && mkcols[0] === '/thaimassage-kiefersfelden', mkcols); + check('_ensureDir MKCOLs normalized path (no https:/ junk, trailing slash for nginx)', + mkcols.length === 1 && mkcols[0] === '/thaimassage-kiefersfelden/', mkcols); // Existing dir fast-path: __list__ probe succeeds -> no MKCOL at all const m2 = makeMod(); @@ -107,7 +107,8 @@ function check(name, cond, got) { m3._listDir = async (p) => { if (p === '/backups') return []; throw new Error('ENOENT'); }; m3._webdavRequest = async (method, path) => { if (method === 'MKCOL') mkcols3.push(path); return { ok: true, status: 201 }; }; await m3._ensureDir('/backups/2026'); - check('_ensureDir MKCOLs only missing tail', mkcols3.length === 1 && mkcols3[0] === '/backups/2026', mkcols3); + check('_ensureDir MKCOLs only missing tail (trailing slash for nginx)', + mkcols3.length === 1 && mkcols3[0] === '/backups/2026/', mkcols3); } // --- PUT via _webdavRequest hits normalized URL --- -- cgit v1.2.3