File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 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 ,
Original file line number Diff line number Diff 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' ) ;
You can’t perform that action at this time.
0 commit comments