owncloud / owncloud/android

[BUG] App is crashing if WebDAV server returns non-empty "getcontenttype" for a collection

Open
#4,053 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
4.2k
Forks
3.1k
Avg merge
1d 12h
Merged PRs (30d)
7

Description

Actual behaviour

Change WebDAV server to return a string for "getcontenttype" for a directory (collection) in the "200 OK" propstat for the resource, item of "getcontenttype" being in the "404 Not Found" propstat.

Refresh the file listing in the app. It crashes and cannot be restarted.

This works:

	<d:response>
		<d:href>/remote.php/webdav/Photos/</d:href>
		<d:propstat>
			<d:prop>
				<d:resourcetype>
					<d:collection/>
				</d:resourcetype>
				<d:getlastmodified>Mon, 03 Oct 2022 01:42:33 GMT</d:getlastmodified>
				<d:getetag>&quot;633a3e099376c&quot;</d:getetag>
				<d:quota-used-bytes>1011464</d:quota-used-bytes>
				<d:quota-available-bytes>-3</d:quota-available-bytes>
				<oc:permissions>RDNVCK</oc:permissions>
				<oc:id>00000013ocaveki6uxj5</oc:id>
				<oc:size>1011464</oc:size>
				<oc:privatelink>http://localhost:8082/index.php/f/13</oc:privatelink>
				<oc:share-types/>
			</d:prop>
			<d:status>HTTP/1.1 200 OK</d:status>
		</d:propstat>
		<d:propstat>
			<d:prop>
				<d:displayname/>
				<d:getcontenttype/>
				<d:getcontentlength/>
				<d:creationdate/>
			</d:prop>
			<d:status>HTTP/1.1 404 Not Found</d:status>
		</d:propstat>
	</d:response>

This makes the app crash:

	<d:response>
		<d:href>/remote.php/webdav/Photos/</d:href>
		<d:propstat>
			<d:prop>
				<d:resourcetype>
					<d:collection/>
				</d:resourcetype>
				<d:getlastmodified>Mon, 03 Oct 2022 01:42:33 GMT</d:getlastmodified>
				<d:getetag>&quot;633a3e099376c&quot;</d:getetag>
				<d:quota-used-bytes>1011464</d:quota-used-bytes>
				<d:quota-available-bytes>-3</d:quota-available-bytes>
				<oc:permissions>RDNVCK</oc:permissions>
				<oc:id>00000013ocaveki6uxj5</oc:id>
				<oc:size>1011464</oc:size>
				<oc:privatelink>http://localhost:8082/index.php/f/13</oc:privatelink>
				<oc:share-types/>
				<d:getcontenttype>something</d:getcontenttype>
			</d:prop>
			<d:status>HTTP/1.1 200 OK</d:status>
		</d:propstat>
		<d:propstat>
			<d:prop>
				<d:displayname/>
				<d:getcontentlength/>
				<d:creationdate/>
			</d:prop>
			<d:status>HTTP/1.1 404 Not Found</d:status>
		</d:propstat>
	</d:response>
Expected behaviour

No crash :)

Generally it seems that the app is very fragile if the WebDAV server response changes, even just a bit, more checks should be done instead of failing dramatically like that.

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 file-list refresh with the two WebDAV XML responses shown in the issue, then trace the crash through the app's WebDAV response handling. Done means the listing no longer crashes when a collection has a non-empty getcontenttype in a 200 OK propstat, while the existing response remains supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.