Skip to content

Commit 285165d

Browse files
committed
Bugfix: Fix missting stat function in webdav server
1 parent cdc41c6 commit 285165d

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

conductor.config.with-dw.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"args": [
55
"dist/index.js",
66
"--dw-json",
7-
"./tests/mcp/test-fixtures/dw.json"
7+
"./tests/mcp/test-fixtures/dw.json",
8+
"--debug"
89
],
910
"cwd": "./",
1011
"startupTimeout": 10000,

tests/servers/webdav/server.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,33 @@ class SFCCMockWebDAVServer {
150150
}
151151

152152
const stats = fs.statSync(fsPath);
153+
154+
// Handle PROPFIND for individual files (used by webdav client's stat() method)
155+
if (stats.isFile()) {
156+
const xml = `<?xml version="1.0" encoding="utf-8"?>
157+
<D:multistatus xmlns:D="DAV:">
158+
<D:response>
159+
<D:href>${urlPath}</D:href>
160+
<D:propstat>
161+
<D:prop>
162+
<D:displayname>${path.basename(fsPath)}</D:displayname>
163+
<D:getcontentlength>${stats.size}</D:getcontentlength>
164+
<D:getlastmodified>${stats.mtime.toUTCString()}</D:getlastmodified>
165+
<D:resourcetype></D:resourcetype>
166+
<D:getcontenttype>text/plain</D:getcontenttype>
167+
</D:prop>
168+
<D:status>HTTP/1.1 200 OK</D:status>
169+
</D:propstat>
170+
</D:response>
171+
</D:multistatus>`;
172+
173+
res.statusCode = 207; // Multi-Status
174+
res.setHeader('Content-Type', 'application/xml');
175+
res.end(xml);
176+
return;
177+
}
178+
179+
// Handle PROPFIND for directories (existing logic)
153180
if (!stats.isDirectory()) {
154181
res.statusCode = 404;
155182
res.end('Not Found');

0 commit comments

Comments
 (0)