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

The version number of a file is incorrect because of the incorrect number of <d:getetag> and <d:getlastmodified> element #1234

Closed
Talank opened this issue Jul 16, 2020 · 3 comments · Fixed by #1833
Labels
Category:Defect Existing functionality is not working as expected QA:team Type:Bug

Comments

@Talank
Copy link
Contributor

Talank commented Jul 16, 2020

During PROPFIND of a file using file id via meta API in OCIS, only one <d:getetag> element is present in the whole response even if multiple versions of the file exist.

Also, the number of <d:getlastmodified> element is 1 more than that in a similar scenario in OC10.

Steps to reproduce

  1. Create user Alice
  2. User Alice uploads a file testfile.txt with content "initial content"
  3. User Alice uploads a file testfile.txt with content "version 1"
  4. User Alice uploads a file testfile.txt with content "version 2"
  5. As user Alice, send an HTTP PROPFIND request to the API endpoint remote.php/dav/meta/<fileid>

Expected behavior

The response should be something like that in OC10 in which there are 2 <d:getetag> elements and 2 <d:getlastmodified> element

Actual behavior (In OCIS)

There is only one <d:getetag> element and 3 <d:getlastmodified> element in the response data

For example, for the request

curl 'https://localhost:9140/remote.php/dav/meta/MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU0OmI1Y2VhNDY1LThlYzUtNGI0Zi05ODE2LTMzODVlODY0Nzk2NQ==/v' \
  -X 'PROPFIND' \
  -u 'Alice:1234' \
  --insecure | xmllint --format -

The response data is as follows.

<?xml version="1.0" encoding="UTF-8"?>
<d:multistatus xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:s="http://sabredav.org/ns">
   <d:response>
      <d:href>/remote.php/dav/meta/MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU0OmI1Y2VhNDY1LThlYzUtNGI0Zi05ODE2LTMzODVlODY0Nzk2NQ==/v/</d:href>
      <d:propstat>
         <d:prop>
            <oc:id>dmlydHVhbDptZXRhL01USTROR1F5TXpndFlXRTVNaTAwTW1ObExXSmtZelF0TUdJd01EQXdNREE1TVRVME9tSTFZMlZoTkRZMUxUaGxZelV0TkdJMFppMDVPREUyTFRNek9EVmxPRFkwTnprMk5RPT0vdg==</oc:id>
            <oc:fileid>dmlydHVhbDptZXRhL01USTROR1F5TXpndFlXRTVNaTAwTW1ObExXSmtZelF0TUdJd01EQXdNREE1TVRVME9tSTFZMlZoTkRZMUxUaGxZelV0TkdJMFppMDVPREUyTFRNek9EVmxPRFkwTnprMk5RPT0vdg==</oc:fileid>
            <d:getetag>"3a040077a22f1f027d5adccb2f3ca510"</d:getetag>
            <d:resourcetype>
               <d:collection />
            </d:resourcetype>
            <d:getcontenttype>httpd/unix-directory</d:getcontenttype>
            <oc:size>0</oc:size>
            <d:getlastmodified>Thu, 16 Jul 2020 12:42:09 +0000</d:getlastmodified>
            <oc:favorite>0</oc:favorite>
         </d:prop>
         <d:status>HTTP/1.1 200 OK</d:status>
      </d:propstat>
   </d:response>
   <d:response>
      <d:href>/remote.php/dav/meta/MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU0OmI1Y2VhNDY1LThlYzUtNGI0Zi05ODE2LTMzODVlODY0Nzk2NQ==/v/1594903328</d:href>
      <d:propstat>
         <d:prop>
            <oc:id>dmVyc2lvbnM6YjVjZWE0NjUtOGVjNS00YjRmLTk4MTYtMzM4NWU4NjQ3OTY1QDE1OTQ5MDMzMjg=</oc:id>
            <oc:fileid>dmVyc2lvbnM6YjVjZWE0NjUtOGVjNS00YjRmLTk4MTYtMzM4NWU4NjQ3OTY1QDE1OTQ5MDMzMjg=</oc:fileid>
            <d:getcontentlength>15</d:getcontentlength>
            <d:getlastmodified>Thu, 16 Jul 2020 12:42:08 +0000</d:getlastmodified>
            <oc:favorite>0</oc:favorite>
         </d:prop>
         <d:status>HTTP/1.1 200 OK</d:status>
      </d:propstat>
   </d:response>
   <d:response>
      <d:href>/remote.php/dav/meta/MTI4NGQyMzgtYWE5Mi00MmNlLWJkYzQtMGIwMDAwMDA5MTU0OmI1Y2VhNDY1LThlYzUtNGI0Zi05ODE2LTMzODVlODY0Nzk2NQ==/v/1594903329</d:href>
      <d:propstat>
         <d:prop>
            <oc:id>dmVyc2lvbnM6YjVjZWE0NjUtOGVjNS00YjRmLTk4MTYtMzM4NWU4NjQ3OTY1QDE1OTQ5MDMzMjk=</oc:id>
            <oc:fileid>dmVyc2lvbnM6YjVjZWE0NjUtOGVjNS00YjRmLTk4MTYtMzM4NWU4NjQ3OTY1QDE1OTQ5MDMzMjk=</oc:fileid>
            <d:getcontentlength>9</d:getcontentlength>
            <d:getlastmodified>Thu, 16 Jul 2020 12:42:09 +0000</d:getlastmodified>
            <oc:favorite>0</oc:favorite>
         </d:prop>
         <d:status>HTTP/1.1 200 OK</d:status>
      </d:propstat>
   </d:response>
</d:multistatus>

In OC10

The response contains 2 <d:getetag> elements and 2 <d:getlastmodified> element.

For example, for the request

curl 'http://localhost/core/remote.php/dav/meta/2147509958/v' \
  -X 'PROPFIND' \
  -u 'Alice:1234' | xmllint --format -

The response data is as follows.

<?xml version="1.0" encoding="UTF-8"?>
<d:multistatus xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:s="http://sabredav.org/ns">
   <d:response>
      <d:href>/core/remote.php/dav/meta/2147509958/v/</d:href>
      <d:propstat>
         <d:prop>
            <d:resourcetype>
               <d:collection />
            </d:resourcetype>
         </d:prop>
         <d:status>HTTP/1.1 200 OK</d:status>
      </d:propstat>
   </d:response>
   <d:response>
      <d:href>/core/remote.php/dav/meta/2147509958/v/1594906715</d:href>
      <d:propstat>
         <d:prop>
            <d:getlastmodified>Thu, 16 Jul 2020 13:38:35 GMT</d:getlastmodified>
            <d:getcontentlength>9</d:getcontentlength>
            <d:resourcetype />
            <d:getetag>"860c81e6fb8528672c64f3fd9c709789"</d:getetag>
            <d:getcontenttype>text/plain</d:getcontenttype>
         </d:prop>
         <d:status>HTTP/1.1 200 OK</d:status>
      </d:propstat>
      <d:propstat>
         <d:prop>
            <d:quota-used-bytes />
            <d:quota-available-bytes />
         </d:prop>
         <d:status>HTTP/1.1 404 Not Found</d:status>
      </d:propstat>
   </d:response>
   <d:response>
      <d:href>/core/remote.php/dav/meta/2147509958/v/1594906714</d:href>
      <d:propstat>
         <d:prop>
            <d:getlastmodified>Thu, 16 Jul 2020 13:38:34 GMT</d:getlastmodified>
            <d:getcontentlength>15</d:getcontentlength>
            <d:resourcetype />
            <d:getetag>"577e2aa465e458d56916ac84624470fd"</d:getetag>
            <d:getcontenttype>text/plain</d:getcontenttype>
         </d:prop>
         <d:status>HTTP/1.1 200 OK</d:status>
      </d:propstat>
      <d:propstat>
         <d:prop>
            <d:quota-used-bytes />
            <d:quota-available-bytes />
         </d:prop>
         <d:status>HTTP/1.1 404 Not Found</d:status>
      </d:propstat>
   </d:response>
</d:multistatus>
@PVince81
Copy link
Contributor

either:

  • the metadata is not preserved when versions are created
    or
  • the versions API is not returning the existing metadata in the response

can you write an API test for this ?

@butonic butonic transferred this issue from owncloud/ocis-reva Jan 18, 2021
@refs refs added Type:Bug Category:Defect Existing functionality is not working as expected labels Jan 18, 2021
@Talank
Copy link
Contributor Author

Talank commented Feb 22, 2021

  • check if there are some tests related to this issue, if there is, then add an issue tag else add a new test.

@Talank Talank added the QA:team label Feb 22, 2021
@phil-davis
Copy link
Contributor

Also see related issue #1633
@Talank Search in the expected-failures files for ocis/issues/1633 - those will be a good place to start looking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category:Defect Existing functionality is not working as expected QA:team Type:Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants