I'm implementing a WebDAV server and I'm currently working on the PROPFIND method.

It works fine in Cyberduck and also in BitKinex. But the problem occurs when I use Windows Explorer: the Windows Explorer always shows one item (file or folder) too few.

In the following XML, you can see that there are two folders (or collections) in the current directory. But when you open the Windows Explorer, only the second folder is shown.

<D:multistatus xmlns:D="DAV:">
    <D:response>
        <D:href>http://localhost:8888/Folder/Folder1</D:href>
        <D:propstat>
            <D:prop>
                <D:creationdate>2014-04-22T12:30:31+02:00</D:creationdate>
                <D:displayname>Folder1</D:displayname>
                <D:getcontentlanguage />
                <D:getcontentlength />
                <D:getcontenttype />
                <D:getetag />
                <D:getlastmodified>
                    Tue, 22 Apr 2014 12:30:31 GMT
                </D:getlastmodified>
                <D:lockdiscovery />
                <D:resourcetype><D:collection /></D:resourcetype>
                <D:supportedlock />
                <D:ishidden>0</D:ishidden>
            </D:prop>
            <D:status>HTTP/1.1 200 OK</D:status>
        </D:propstat>
    </D:response>
    <D:response>
        <D:href>http://localhost:8888/Folder/Folder2</D:href>
        <D:propstat>
            <D:prop>
                <D:creationdate>2014-04-22T12:30:44+02:00</D:creationdate>
                <D:displayname>Folder2</D:displayname>
                <D:getcontentlanguage />
                <D:getcontentlength />
                <D:getcontenttype />
                <D:getetag />
                <D:getlastmodified>
                    Tue, 22 Apr 2014 12:30:44 GMT
                </D:getlastmodified>
                <D:lockdiscovery />
                <D:resourcetype><D:collection /></D:resourcetype>
                <D:supportedlock />
                <D:ishidden>0</D:ishidden>
            </D:prop>
            <D:status>HTTP/1.1 200 OK</D:status>
        </D:propstat>
    </D:response>
</D:multistatus>

What should I do to make Windows Explorer show both items ?

有帮助吗?

解决方案

I have found the solution to this problem. The current folder must be included in the response body, and not only it's children. And Windows Explorer doesn't show the first response element.

What the XML from above should be:

<D:multistatus xmlns:D="DAV:">
<D:response>
        <D:href>http://localhost:8888/Folder/</D:href>
        <D:propstat>
            <D:prop>
                <D:creationdate>2014-04-22T12:30:30+15:00</D:creationdate>
                <D:displayname>Folder1</D:displayname>
                <D:getcontentlanguage />
                <D:getcontentlength />
                <D:getcontenttype />
                <D:getetag />
                <D:getlastmodified>
                    Tue, 22 Apr 2014 12:29:41 GMT
                </D:getlastmodified>
                <D:lockdiscovery />
                <D:resourcetype><D:collection /></D:resourcetype>
                <D:supportedlock />
                <D:ishidden>0</D:ishidden>
            </D:prop>
            <D:status>HTTP/1.1 200 OK</D:status>
        </D:propstat>
    </D:response>
    <D:response>
        <D:href>http://localhost:8888/Folder/Folder1</D:href>
        <D:propstat>
            <D:prop>
                <D:creationdate>2014-04-22T12:30:31+02:00</D:creationdate>
                <D:displayname>Folder1</D:displayname>
                <D:getcontentlanguage />
                <D:getcontentlength />
                <D:getcontenttype />
                <D:getetag />
                <D:getlastmodified>
                    Tue, 22 Apr 2014 12:30:31 GMT
                </D:getlastmodified>
                <D:lockdiscovery />
                <D:resourcetype><D:collection /></D:resourcetype>
                <D:supportedlock />
                <D:ishidden>0</D:ishidden>
            </D:prop>
            <D:status>HTTP/1.1 200 OK</D:status>
        </D:propstat>
    </D:response>
    <D:response>
        <D:href>http://localhost:8888/Folder/Folder2</D:href>
        <D:propstat>
            <D:prop>
                <D:creationdate>2014-04-22T12:30:44+02:00</D:creationdate>
                <D:displayname>Folder2</D:displayname>
                <D:getcontentlanguage />
                <D:getcontentlength />
                <D:getcontenttype />
                <D:getetag />
                <D:getlastmodified>
                    Tue, 22 Apr 2014 12:30:44 GMT
                </D:getlastmodified>
                <D:lockdiscovery />
                <D:resourcetype><D:collection /></D:resourcetype>
                <D:supportedlock />
                <D:ishidden>0</D:ishidden>
            </D:prop>
            <D:status>HTTP/1.1 200 OK</D:status>
        </D:propstat>
    </D:response>
</D:multistatus>

More information here: http://www.webdav.org/specs/rfc2518.html#rfc.section.8.1.2

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top