Propfind:Windows资源管理器未显示第一个文件

本文关键字:显示 第一个 文件 资源管理器 Windows Propfind | 更新日期: 2023-09-27 17:59:16

我正在实现WebDAV服务器,目前正在研究PROPFIND方法。

它在Cyberduck和BitKinex中运行良好。但是当我使用Windows资源管理器时会出现问题:Windows资源管理器总是显示一个项目(文件或文件夹)太少。

在下面的XML中,您可以看到当前目录中有两个文件夹(或集合)。但当您打开Windows资源管理器时,只显示第二个文件夹。

<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>

如何使Windows资源管理器同时显示这两个项目?

Propfind:Windows资源管理器未显示第一个文件

我已经找到了这个问题的解决方案。当前文件夹必须包含在响应正文中,而不仅仅是它的子文件夹。Windows资源管理器不显示第一个响应元素。

上面的XML应该是什么:

<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>

更多信息请点击此处:http://www.webdav.org/specs/rfc2518.html#rfc.section.8.1.2