owncloud / owncloud/core

PROPPATCHing lastmodified property clears checksums

Open
#37,744 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type:Bug
Dominant language
PHP
Stars
8.8k
Forks
2.1k
Avg merge
20h 7m
Merged PRs (30d)
41

Description

Steps to reproduce
  1. PROPPATCH the lastmodified property of a resource, e.g. in the following way:

Request:
curl -u admin:admin "http://localhost:8080/remote.php/dav/files/admin/test.txt" -X PROPPATCH --data-binary @"patch.xml"

patch.xml:

<?xml version="1.0" encoding="utf-8" ?>
<a:propertyupdate xmlns:a="DAV:" xmlns:oc="http://owncloud.org/ns">
	<a:set>
		<a:prop>
			<a:lastmodified>1234</a:lastmodified>
		</a:prop>
	</a:set>
</a:propertyupdate>

Response:

<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">
	<d:response>
		<d:href>/remote.php/dav/files/admin/test.txt</d:href>
		<d:propstat>
			<d:prop>
				<d:lastmodified/>
			</d:prop>
			<d:status>HTTP/1.1 200 OK</d:status>
		</d:propstat>
	</d:response>
</d:multistatus>
Expected behaviour

The checksums of the file should not be changed.

Actual behaviour

The checksums of the file were cleared, as can be seen in the database:

+--------+---------+----------------+----------+------+-------+---------------+----------------------------------+----------+
| fileid | storage | path           | name     | size | mtime | storage_mtime | etag                             | checksum |
+--------+---------+----------------+----------+------+-------+---------------+----------------------------------+----------+
|  10246 |       1 | files/test.txt | test.txt |  253 |  1234 |          1234 | 7c065477017d493827737604c320d3c8 |          |
+--------+---------+----------------+----------+------+-------+---------------+----------------------------------+----------+

PROPFIND:

Request:
curl -u admin:admin "http://localhost:8080/remote.php/dav/files/admin/test.txt" -X PROPFIND --data-binary @"find.xml"

find.xml:

<?xml version="1.0" encoding="UTF-8"?>
<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
	<d:prop>
		<d:getlastmodified/>
		<oc:checksums/>
	</d:prop>
</d:propfind>

Response:

<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">
	<d:response>
		<d:href>/remote.php/dav/files/admin/test.txt</d:href>
		<d:propstat>
			<d:prop>
				<d:getlastmodified>Thu, 01 Jan 1970 00:20:34 GMT</d:getlastmodified>
			</d:prop>
			<d:status>HTTP/1.1 200 OK</d:status>
		</d:propstat>
		<d:propstat>
			<d:prop>
				<oc:checksums/>
			</d:prop>
			<d:status>HTTP/1.1 404 Not Found</d:status>
		</d:propstat>
	</d:response>
</d:multistatus>

ownCloud version: 10.4.1 (stable)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the PROPPATCH request against remote.php/dav and inspect the DAV handling of the lastmodified property alongside checksum persistence in the database. Verify the fix by confirming that updating lastmodified changes the timestamp without clearing the file checksum, then repeat the PROPFIND check.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, backend, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.