Skip to content

feat: contacts import ocs#61277

Open
SebastianKrupinski wants to merge 1 commit into
feat/calendar-import-export-ocsfrom
feat/contacts-import-ocs
Open

feat: contacts import ocs#61277
SebastianKrupinski wants to merge 1 commit into
feat/calendar-import-export-ocsfrom
feat/contacts-import-ocs

Conversation

@SebastianKrupinski

@SebastianKrupinski SebastianKrupinski commented Jun 13, 2026

Copy link
Copy Markdown
Contributor
  • Resolves: client feature

Summary

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
@SebastianKrupinski SebastianKrupinski force-pushed the feat/contacts-import-ocs branch from 9e175b9 to 7553769 Compare June 24, 2026 19:27
@SebastianKrupinski SebastianKrupinski added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jun 24, 2026
@SebastianKrupinski SebastianKrupinski added this to the Nextcloud 35 milestone Jun 24, 2026
@SebastianKrupinski SebastianKrupinski marked this pull request as ready for review June 24, 2026 19:33
@SebastianKrupinski SebastianKrupinski requested review from a team and hamza221 as code owners June 24, 2026 19:33
@SebastianKrupinski SebastianKrupinski requested review from ArtificialOwl, ChristophWurst, come-nc, icewind1991 and leftybournes and removed request for a team June 24, 2026 19:33

use JsonSerializable;

interface ImportEvent extends JsonSerializable {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What value does this interface add of it has no methods?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a common type for ImportCountEvent and ImportObjectEvent, its used to stream events all the way to the UI while processing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. For simplicity, could you just use JsonSerializable in the few areas you use ImportEvent right now?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think I would prefer the current way to make it more clear what's being expected from a readability standpoint 🤔

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR has to be backported. Can we keep it simple?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add the YAGNI abstraction to master. But for the backportable bit let's skip it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR has to be backported. Can we keep it simple?

Ahh, yeah, I didn't had that in mind. So, I'll agree with you 😄

}
return match ($options->getFormat()) {
'vcf' => $this->importProcess($source, $addressBook, $options, $this->importText(...)),
'jcf' => $this->importProcess($source, $addressBook, $options, $this->importJson(...)),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Json and Xml aren't implemented (I've tested that, instant crash). So, maybe makes sense to remove for now?

@DerDreschner

DerDreschner commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

There are still some issues 🤔 The getResourceId() is sometimes missing during import and I run into memory exhaustion issues... I'm not sure if it's connected with each other or not 🤔

Call to undefined method OCA\\ContactsInteraction\\AddressBook::getResourceId()
{"reqId":"OgTnmGJkVZnr3LXtUfGS","level":3,"time":"2026-07-02T12:55:03+00:00","remoteAddr":"192.168.21.6","user":"admin","app":"webdav","method":"GET","url":"/remote.php/dav/addressbooks/users/admin/z-app-generated--contactsinteraction--recent/4?photo","scriptName":"/remote.php","message":"Call to undefined method OCA\\ContactsInteraction\\AddressBook::getResourceId()","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0","version":"35.0.0.1","exception":{"Exception":"Error","Message":"Call to undefined method OCA\\ContactsInteraction\\AddressBook::getResourceId()","Code":0,"Trace":[{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpGet","class":"OCA\\DAV\\CardDAV\\ImageExportPlugin","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["method:GET",[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/apps/dav/lib/Connector/Sabre/Server.php","line":216,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/apps/dav/lib/Server.php","line":431,"function":"start","class":"OCA\\DAV\\Connector\\Sabre\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/appinfo/v2/remote.php","line":25,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/remote.php","line":152,"args":["/var/www/html/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/apps/dav/lib/CardDAV/ImageExportPlugin.php","Line":90,"message":"Call to undefined method OCA\\ContactsInteraction\\AddressBook::getResourceId()","exception":"{\"class\":\"Error\",\"message\":\"Call to undefined method OCA\\ContactsInteraction\\AddressBook::getResourceId()\",\"code\":0,\"file\":\"/var/www/html/apps/dav/lib/CardDAV/ImageExportPlugin.php:90\",\"trace\":\"#0 /var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php(89): OCA\\DAV\\CardDAV\\ImageExportPlugin->httpGet(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\\n#1 /var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php(472): Sabre\\DAV\\Server->emit('method:GET', Array)\\n#2 /var/www/html/apps/dav/lib/Connector/Sabre/Server.php(216): Sabre\\DAV\\Server->invokeMethod(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\\n#3 /var/www/html/apps/dav/lib/Server.php(431): OCA\\DAV\\Connector\\Sabre\\Server->start()\\n#4 /var/www/html/apps/dav/appinfo/v2/remote.php(25): OCA\\DAV\\Server->exec()\\n#5 /var/www/html/remote.php(152): require_once('/var/www/html/a...')\\n#6 {main}\"}","CustomMessage":"Call to undefined method OCA\\ContactsInteraction\\AddressBook::getResourceId()"}}
Memory exhausted
{"reqId":"3iMSiAmNrULlhfwSaiDO","level":3,"time":"2026-07-02T12:50:25+00:00","remoteAddr":"192.168.21.6","user":"admin","app":"PHP","method":"POST","url":"/ocs/v2.php/contacts/import","scriptName":"/ocs/v2.php","message":"Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) at /var/www/html/lib/private/DB/BacktraceDebugStack.php#17","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0","version":"35.0.0.1","data":{"app":"PHP"}}

And the following warning is being thrown sometimes at the end of the import:

Header already modified
{"reqId":"JB6VEaCQag0xFUSRnBht","level":2,"time":"2026-07-02T12:45:12+00:00","remoteAddr":"192.168.21.6","user":"--","app":"PHP","method":"GET","url":"/ocs/v2.php/core/update?requesttoken=U7cE4APNLGXov5ztfdWmRSwUhHYe5Org0dXwAUQs8RQ%3D%3AfINmkGy1HQ6Z8%2FOCP%2BHPNGNRwwRHkJ2zoeKaaCJPplc%3D","scriptName":"/ocs/v2.php","message":"Cannot modify header information - headers already sent at /var/www/html/lib/private/AppFramework/Http/Output.php#50","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0","version":"35.0.0.1","data":{"app":"PHP"}}
{"reqId":"JB6VEaCQag0xFUSRnBht","level":2,"time":"2026-07-02T12:45:12+00:00","remoteAddr":"192.168.21.6","user":"--","app":"PHP","method":"GET","url":"/ocs/v2.php/core/update?requesttoken=U7cE4APNLGXov5ztfdWmRSwUhHYe5Org0dXwAUQs8RQ%3D%3AfINmkGy1HQ6Z8%2FOCP%2BHPNGNRwwRHkJ2zoeKaaCJPplc%3D","scriptName":"/ocs/v2.php","message":"Cannot modify header information - headers already sent at /var/www/html/lib/private/AppFramework/Http/Output.php#50","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0","version":"35.0.0.1","data":{"app":"PHP"}}
{"reqId":"JB6VEaCQag0xFUSRnBht","level":2,"time":"2026-07-02T12:45:12+00:00","remoteAddr":"192.168.21.6","user":"--","app":"PHP","method":"GET","url":"/ocs/v2.php/core/update?requesttoken=U7cE4APNLGXov5ztfdWmRSwUhHYe5Org0dXwAUQs8RQ%3D%3AfINmkGy1HQ6Z8%2FOCP%2BHPNGNRwwRHkJ2zoeKaaCJPplc%3D","scriptName":"/ocs/v2.php","message":"Cannot modify header information - headers already sent at /var/www/html/lib/private/AppFramework/Http/Output.php#50","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0","version":"35.0.0.1","data":{"app":"PHP"}}
{"reqId":"JB6VEaCQag0xFUSRnBht","level":2,"time":"2026-07-02T12:45:12+00:00","remoteAddr":"192.168.21.6","user":"--","app":"PHP","method":"GET","url":"/ocs/v2.php/core/update?requesttoken=U7cE4APNLGXov5ztfdWmRSwUhHYe5Org0dXwAUQs8RQ%3D%3AfINmkGy1HQ6Z8%2FOCP%2BHPNGNRwwRHkJ2zoeKaaCJPplc%3D","scriptName":"/ocs/v2.php","message":"Cannot modify header information - headers already sent at /var/www/html/lib/private/AppFramework/Http/Output.php#50","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0","version":"35.0.0.1","data":{"app":"PHP"}}
{"reqId":"JB6VEaCQag0xFUSRnBht","level":2,"time":"2026-07-02T12:45:12+00:00","remoteAddr":"192.168.21.6","user":"--","app":"PHP","method":"GET","url":"/ocs/v2.php/core/update?requesttoken=U7cE4APNLGXov5ztfdWmRSwUhHYe5Org0dXwAUQs8RQ%3D%3AfINmkGy1HQ6Z8%2FOCP%2BHPNGNRwwRHkJ2zoeKaaCJPplc%3D","scriptName":"/ocs/v2.php","message":"Cannot modify header information - headers already sent at /var/www/html/lib/private/AppFramework/Http/Output.php#50","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0","version":"35.0.0.1","data":{"app":"PHP"}}
{"reqId":"JB6VEaCQag0xFUSRnBht","level":2,"time":"2026-07-02T12:45:12+00:00","remoteAddr":"192.168.21.6","user":"--","app":"PHP","method":"GET","url":"/ocs/v2.php/core/update?requesttoken=U7cE4APNLGXov5ztfdWmRSwUhHYe5Org0dXwAUQs8RQ%3D%3AfINmkGy1HQ6Z8%2FOCP%2BHPNGNRwwRHkJ2zoeKaaCJPplc%3D","scriptName":"/ocs/v2.php","message":"Cannot modify header information - headers already sent at /var/www/html/lib/private/AppFramework/Http/Output.php#50","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0","version":"35.0.0.1","data":{"app":"PHP"}}
{"reqId":"JB6VEaCQag0xFUSRnBht","level":2,"time":"2026-07-02T12:45:12+00:00","remoteAddr":"192.168.21.6","user":"--","app":"PHP","method":"GET","url":"/ocs/v2.php/core/update?requesttoken=U7cE4APNLGXov5ztfdWmRSwUhHYe5Org0dXwAUQs8RQ%3D%3AfINmkGy1HQ6Z8%2FOCP%2BHPNGNRwwRHkJ2zoeKaaCJPplc%3D","scriptName":"/ocs/v2.php","message":"Cannot modify header information - headers already sent at /var/www/html/lib/private/AppFramework/Http/Output.php#50","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0","version":"35.0.0.1","data":{"app":"PHP"}}
{"reqId":"JB6VEaCQag0xFUSRnBht","level":2,"time":"2026-07-02T12:45:12+00:00","remoteAddr":"192.168.21.6","user":"--","app":"PHP","method":"GET","url":"/ocs/v2.php/core/update?requesttoken=U7cE4APNLGXov5ztfdWmRSwUhHYe5Org0dXwAUQs8RQ%3D%3AfINmkGy1HQ6Z8%2FOCP%2BHPNGNRwwRHkJ2zoeKaaCJPplc%3D","scriptName":"/ocs/v2.php","message":"Cannot modify header information - headers already sent at /var/www/html/lib/private/AppFramework/Http/Output.php#50","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0","version":"35.0.0.1","data":{"app":"PHP"}}
{"reqId":"JB6VEaCQag0xFUSRnBht","level":2,"time":"2026-07-02T12:45:12+00:00","remoteAddr":"192.168.21.6","user":"--","app":"PHP","method":"GET","url":"/ocs/v2.php/core/update?requesttoken=U7cE4APNLGXov5ztfdWmRSwUhHYe5Org0dXwAUQs8RQ%3D%3AfINmkGy1HQ6Z8%2FOCP%2BHPNGNRwwRHkJ2zoeKaaCJPplc%3D","scriptName":"/ocs/v2.php","message":"Cannot modify header information - headers already sent at /var/www/html/lib/private/AppFramework/Http/Output.php#50","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0","version":"35.0.0.1","data":{"app":"PHP"}}
{"reqId":"JB6VEaCQag0xFUSRnBht","level":2,"time":"2026-07-02T12:45:12+00:00","remoteAddr":"192.168.21.6","user":"--","app":"PHP","method":"GET","url":"/ocs/v2.php/core/update?requesttoken=U7cE4APNLGXov5ztfdWmRSwUhHYe5Org0dXwAUQs8RQ%3D%3AfINmkGy1HQ6Z8%2FOCP%2BHPNGNRwwRHkJ2zoeKaaCJPplc%3D","scriptName":"/ocs/v2.php","message":"Cannot modify header information - headers already sent at /var/www/html/lib/private/AppFramework/Http/Output.php#50","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0","version":"35.0.0.1","data":{"app":"PHP"}}
{"reqId":"JB6VEaCQag0xFUSRnBht","level":2,"time":"2026-07-02T12:45:12+00:00","remoteAddr":"192.168.21.6","user":"--","app":"PHP","method":"GET","url":"/ocs/v2.php/core/update?requesttoken=U7cE4APNLGXov5ztfdWmRSwUhHYe5Org0dXwAUQs8RQ%3D%3AfINmkGy1HQ6Z8%2FOCP%2BHPNGNRwwRHkJ2zoeKaaCJPplc%3D","scriptName":"/ocs/v2.php","message":"Cannot modify header information - headers already sent at /var/www/html/lib/private/AppFramework/Http/Output.php#50","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0","version":"35.0.0.1","data":{"app":"PHP"}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews enhancement feature: carddav Related to CardDAV internals feature: dav

Projects

Status: 🏗️ In progress

Development

Successfully merging this pull request may close these issues.

3 participants