diff options
| author | Agando <roduccomm@gmail.com> | 2026-10-02 21:25:46 +0200 |
|---|---|---|
| committer | Agando <roduccomm@gmail.com> | 2026-10-02 21:25:46 +0200 |
| commit | 6a0cb8cc84ad2cf9bf17d008823d07e5958c6e0a (patch) | |
| tree | 05994acc3e40422157469d06c0108f7b8c136d03 /scripts/test-webdav-paths.mjs | |
| parent | 9a81c96b5a3941898f99665335ad679ff2105666 (diff) | |
newOS4 v4.6.18: nginx dav trailing-slash semantics
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)
Diffstat (limited to 'scripts/test-webdav-paths.mjs')
| -rw-r--r-- | scripts/test-webdav-paths.mjs | 9 |
1 files changed, 5 insertions, 4 deletions
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 --- |