dom111 / webdav-js

A simple WebDAV client written in JS for use as a bookmarklet, or integration into a web server.
MIT License
85 stars 17 forks source link

[Bug] IIS error when click on back button <- #125

Open stokito opened 1 year ago

stokito commented 1 year ago

HEAD http://localhost/http:/localhost/ failed: Not Found (404)

E.g. the folder name contains the full url.

This is probably happens because IIS returns <D:href>http://localhost/folder/New%20folder/</D:href> e.g. a full url while lighttpd only relative path <D:href>/dav/photos/</D:href>

IIS sample:

<D:multistatus xmlns:D="DAV:">
    <D:response>
        <D:href>http://localhost/folder/New%20folder/</D:href>
        <D:propstat>
            <D:status>HTTP/1.1 200 OK</D:status>
            <D:prop>
                <D:getcontenttype/>
                <D:getlastmodified>Wed, 14 Dec 2022 15:16:37 GMT</D:getlastmodified>
                <D:lockdiscovery/>
                <D:ishidden>0</D:ishidden>
                <D:getetag/>
                <D:displayname>New folder</D:displayname>
                <D:getcontentlanguage/>
                <D:getcontentlength>0</D:getcontentlength>
                <D:iscollection>1</D:iscollection>
                <D:creationdate>2020-07-25T16:35:43.621Z</D:creationdate>
                <D:resourcetype>
                    <D:collection/>
                </D:resourcetype>
            </D:prop>
        </D:propstat>
    </D:response>
    <D:response>
        <D:href>http://localhost/folder/New%20folder/README.txt</D:href>
        <D:propstat>
            <D:status>HTTP/1.1 200 OK</D:status>
            <D:prop>
                <D:getcontenttype>text/plain</D:getcontenttype>
                <D:getlastmodified>Fri, 08 May 2020 15:05:59 GMT</D:getlastmodified>
                <D:lockdiscovery/>
                <D:ishidden>0</D:ishidden>
                <D:getetag>"48f2a42e4a25d61:0"</D:getetag>
                <D:displayname>README.txt</D:displayname>
                <D:getcontentlanguage/>
                <D:getcontentlength>2221</D:getcontentlength>
                <D:iscollection>0</D:iscollection>
                <D:creationdate>2020-07-25T20:45:32.524Z</D:creationdate>
                <D:resourcetype/>
            </D:prop>
        </D:propstat>
    </D:response>
</D:multistatus>

Lighttpd sample

    <D:response>
        <D:href>/dav/</D:href>
        <D:propstat>
            <D:prop>
                <D:getcontentlength>4096</D:getcontentlength>
                <D:getcontenttype>httpd/unix-directory</D:getcontenttype>
                <D:getetag>"1476655771"</D:getetag>
                <D:getlastmodified ns0:dt="dateTime.rfc1123">Wed, 01 Mar 2023 19:56:42 GMT</D:getlastmodified>
                <D:resourcetype>
                    <D:collection/>
                </D:resourcetype>
                 <D:lockdiscovery></D:lockdiscovery>
            </D:prop>
            <D:status>HTTP/1.1 200 OK</D:status>
        </D:propstat>
    </D:response>
    <D:response>
        <D:href>/dav/index.html</D:href>
        <D:propstat>
            <D:prop>
                <D:getcontentlength>305</D:getcontentlength>
                <D:getcontenttype>text/html</D:getcontenttype>
                <D:getetag>"1099491739"</D:getetag>
                <D:getlastmodified ns0:dt="dateTime.rfc1123">Wed, 01 Mar 2023 09:55:32 GMT</D:getlastmodified>
                <D:resourcetype/>
                <D:lockdiscovery></D:lockdiscovery>
            </D:prop>
            <D:status>HTTP/1.1 200 OK</D:status>
        </D:propstat>
    </D:response>
    <D:response>
        <D:href>/dav/photos/</D:href>
        <D:propstat>
            <D:prop>
                <D:getcontentlength>4096</D:getcontentlength>
                <D:getcontenttype>httpd/unix-directory</D:getcontenttype>
                <D:getetag>"1208048091"</D:getetag>
                <D:getlastmodified ns0:dt="dateTime.rfc1123">Wed, 01 Mar 2023 09:53:46 GMT</D:getlastmodified>
                <D:resourcetype>
                    <D:collection/>
                </D:resourcetype>
              </D:prop>
            <D:status>HTTP/1.1 200 OK</D:status>
        </D:propstat>
    </D:response>