Auto-upload misses files and creates bad entries in activity log
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 2.5k
- Forks
- 1k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 13
Description
Steps to reproduce
- Take a series of photos with two iPhones, one with the Nextcloud client
- Use the auto upload feature of the Nextcloud iPhone to upload all of its photos, close the Nextcloud client
- Send the photos from the other iPhone to the Nextcloud iPhone via iMessage, save them to the main camera roll
- Open Nextcloud client again and auto-upload
Expected behaviour
All of the photos should now be uploaded to Nextcloud
Actual behaviour
Only some of the other iPhone's photos are uploaded to Nextcloud. All of the photos from the secondary iPhone taken after all of the photos from the primary iPhone will actually be uploaded. However, some of the other photos may or may not be uploaded. In my case, several that were taken in between my iPhone's photos were not uploaded. Instead, spurious entries were created in my activity log saying that "PHOTO NAME" was created, where "PHOTO NAME" was previously uploaded.
This obviously has something to do with the timestamps of the photos. The Nextcloud client is, at some point, only looking for photos with ctime/mtime greater than the most previously uploaded photo. This behavior is buggy when photos are transferred from other iPhones (at least through iMessage, though I suspect you'd get the same behavior with e.g. AirDrop), since their ctimes/mtimes are preserved. A different method has to be used.
Screenshots
Here are a couple screenshots showing the issue with the activity log. The previous "created" entry for that photo was removed.


Logs
I can't find the iOS logs. My server log as several of these around the time of the second auto-upload, one every 30 seconds or so for a few minutes.
[core] Error: Doctrine\DBAL\Query\QueryException: More than 1000 expressions in a list are not allowed on Oracle. at <<closure>>
0. /snap/nextcloud/XXX/htdocs/lib/private/Comments/Manager.php line 656
OC\DB\QueryBuilder\QueryBuilder->execute()
1. /snap/nextcloud/XXX/htdocs/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php line 89
OC\Comments\Manager->getNumberOfUnreadCommentsForObjects("files", ["XXX","XXX ... "], OC\User\User {})
2. /snap/nextcloud/XXX/htdocs/apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php line 117
OCA\DAV\Connector\Sabre\CommentPropertiesPlugin->cacheDirectory(OCA\DAV\Connector\Sabre\Directory {})
3. /snap/nextcloud/XXX/htdocs/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
OCA\DAV\Connector\Sabre\CommentPropertiesPlugin->handleGetProperties(Sabre\DAV\PropFind {}, OCA\DAV\Connector\Sabre\Directory {})
4. /snap/nextcloud/XXX/htdocs/3rdparty/sabre/dav/lib/DAV/Server.php line 1052
Sabre\DAV\Server->emit("propFind", [Sabre\DAV\PropF ... }])
5. /snap/nextcloud/XXX/htdocs/3rdparty/sabre/dav/lib/DAV/Server.php line 984
Sabre\DAV\Server->getPropertiesByNode(Sabre\DAV\PropFind {}, OCA\DAV\Connector\Sabre\Directory {})
6. /snap/nextcloud/XXX/htdocs/3rdparty/sabre/dav/lib/DAV/Server.php line 1661
Sabre\DAV\Server->getPropertiesIteratorForPath("files/emichael/XXX", ["{DAV:}getlastm ... "], 1)
7. /snap/nextcloud/XXX/htdocs/3rdparty/sabre/dav/lib/DAV/Server.php line 1646
Sabre\DAV\Server->writeMultiStatus(Sabre\Xml\Writer ... ]}, Generator {}, false)
8. /snap/nextcloud/XXX/htdocs/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 346
Sabre\DAV\Server->generateMultiStatus(Generator {}, false)
9. /snap/nextcloud/XXX/htdocs/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
Sabre\DAV\CorePlugin->httpPropFind(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
10. /snap/nextcloud/XXX/htdocs/3rdparty/sabre/dav/lib/DAV/Server.php line 472
Sabre\DAV\Server->emit("method:PROPFIND", [Sabre\HTTP\Requ ... }])
11. /snap/nextcloud/XXX/htdocs/3rdparty/sabre/dav/lib/DAV/Server.php line 253
Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
12. /snap/nextcloud/XXX/htdocs/3rdparty/sabre/dav/lib/DAV/Server.php line 321
Sabre\DAV\Server->start()
13. /snap/nextcloud/XXX/htdocs/apps/dav/lib/Server.php line 332
Sabre\DAV\Server->exec()
14. /snap/nextcloud/XXX/htdocs/apps/dav/appinfo/v2/remote.php line 35
OCA\DAV\Server->exec()
15. /snap/nextcloud/XXX/htdocs/remote.php line 167
require_once("/snap/nextcloud ... p")
PROPFIND /remote.php/dav/files/emichael/XXX
from XXX.XXX.XXX.XXX by emichael at 2021-08-01T22:42:53+00:00
Reasoning or why should it be changed/implemented?
This is a critical bug in the iOS auto-upload feature. If photos are also deleted from the camera roll automatically, this could result in data loss.
Environment data
iOS version: iOS 14.7.1
Nextcloud iOS app version: 4.0.4.0
Server operating system: Ubuntu 18.04
Nextcloud version: snap latest, 21.0.3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the iOS auto-upload feature and reproduce the two-iPhone sequence, focusing on photos whose timestamps are preserved after transfer. Compare the upload result with the server activity log and the reported PROPFIND error in apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php. Done means every photo is uploaded without duplicate or spurious activity entries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100