Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webdav: REPORT vs PROPFIND behaves different in MultiStatus, thus parsing fails #15029

Closed
tobiasKaminsky opened this issue Apr 10, 2019 · 2 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: dav

Comments

@tobiasKaminsky
Copy link
Member

To have faster favorites, I wanted to use REPORT instead of SEARCH on Android.
We already use MultiStatusResponse when reading a folder (and we rely on our dav library for this).

Following is the same folder result, one retrieved via REPORT and one via PROPFIND:

<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:nc="http://nextcloud.org/ns" xmlns:oc="http://owncloud.org/ns">
    <d:response>
        <d:href>/nc/remote.php/webdav/testFolder/</d:href>
        <d:propstat>
            <d:prop>
                <oc:owner-id>test</oc:owner-id>
                <d:getetag>&quot;5cad995a5281a&quot;</d:getetag>
                <oc:permissions>RGDNVCK</oc:permissions>
                <d:getlastmodified>Wed, 10 Apr 2019 07:20:58 GMT</d:getlastmodified>
                <oc:id>00080126ocjycgrudn78</oc:id>
                <oc:favorite>1</oc:favorite>
                <nc:mount-type></nc:mount-type>
                <nc:note></nc:note>
                <nc:has-preview>false</nc:has-preview>
                <oc:size>0</oc:size>
                <nc:is-encrypted>0</nc:is-encrypted>
                <oc:owner-display-name>test</oc:owner-display-name>
                <oc:comments-unread>0</oc:comments-unread>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
        <d:propstat>
            <d:prop>
                <d:creationdate />
                <d:getcontentlength />
                <d:getcontenttype />
            </d:prop>
            <d:status>HTTP/1.1 404 Not Found</d:status>
        </d:propstat>
    </d:response>
</d:multistatus>

REPORT:

<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
    <d:response>
        <d:status>HTTP/1.1 200 OK</d:status>
        <d:href>/nc/remote.php/dav/files/test/testFolder</d:href>
        <d:propstat>
            <d:prop>
                <oc:owner-id>test</oc:owner-id>
                <d:getetag>&quot;5cad995a5281a&quot;</d:getetag>
                <oc:permissions>RGDNVCK</oc:permissions>
                <d:getlastmodified>Wed, 10 Apr 2019 07:20:58 GMT</d:getlastmodified>
                <oc:id>00080126ocjycgrudn78</oc:id>
                <oc:favorite>1</oc:favorite>
                <nc:mount-type></nc:mount-type>
                <nc:note></nc:note>
                <nc:has-preview>false</nc:has-preview>
                <oc:size>0</oc:size>
                <nc:is-encrypted>0</nc:is-encrypted>
                <oc:owner-display-name>test</oc:owner-display-name>
                <oc:comments-unread>0</oc:comments-unread>
            </d:prop>
            <d:status>HTTP/1.1 200 OK</d:status>
        </d:propstat>
        <d:propstat>
            <d:prop>
                <d:creationdate/>
                <d:getcontentlength/>
                <d:getcontenttype/>
            </d:prop>
            <d:status>HTTP/1.1 404 Not Found</d:status>
        </d:propstat>
    </d:response>
</d:multistatus>

The only difference is that in REPORT we have an additional
<d:status>HTTP/1.1 200 OK</d:status> as child of response.
And this confuse our lib in a way that it does not parse propstat.

@tobiasKaminsky tobiasKaminsky added bug 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Apr 10, 2019
@tobiasKaminsky
Copy link
Member Author

tobiasKaminsky commented Apr 10, 2019

Parsing in library is done here:
https://github.com/apache/jackrabbit/blob/trunk/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/MultiStatusResponse.java#L443-L450

So if <d:status></d:status> is detected no more parsing happens.
Maybe it would therefore be enough to move the status part to the end?

@tobiasKaminsky
Copy link
Member Author

This seems to work now, but #17586 is another problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: dav
Projects
None yet
Development

No branches or pull requests

1 participant