-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Multi vcf download plugin #12004
Multi vcf download plugin #12004
Conversation
If that call does not change any server state, yes. |
Yes, I'm thinking that as well, but since muti dimentionnal arrays are terribly looking as url, I wonder if some browsers can go 💥 with that? |
Also you hit the various browser url length limits at some point |
Arf, damn! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some general coding style feedback. Can't argue much about the logic as I'm not familiar with the details of DAV and VCF 🤷♂️
|
||
// checking that the path is a valid addressbook | ||
if ($node instanceof AddressBook) { | ||
$addressbooks = array_merge($addressbooks, [$addressbook => $vcards]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$addressbooks = array_merge($addressbooks, [$addressbook => $vcards]); | |
$addressbooks[$addressbook] = $vcards; |
would do the exact same I guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I can drop this I think now. I don't use $addressbooks anymore! 👍
Well using POST helps for that. With GET you could run into isues if people select their whole addressbook |
Hum, no better ideas out there? Anyone? |
This is the only way I also have in mind :/ |
Found https://stackoverflow.com/a/2659995/2239067 and https://stackoverflow.com/a/417184/2239067 telling me the limit is at ~2KB. Based on the example URL provided I assume a typical URL parameter is up to 100 bytes longs, allowing just 20 contacts/parameters. Since this is DAV anyway, this answer might be relevant: https://stackoverflow.com/questions/978061/http-get-with-request-body#comment10368662_978061 IMO using POST for this seems wrong as it's an idempotent operation. Still, GET is also not right, esp. with the technical limitations. |
How about the REPORT request, that was specifically invented for that kind of a request against a CardDAV server? See Building a CardDAV client, search for the keyword "multiget". Or is that impossible, because we are limited to GET, POST, PUT and DELETE here? |
@skjnldsv I don't think we need a dedicated plugin for that. You can perform a simple addressbook-multiget, put them all together into one big vcf in javascript and use a data-uri link to download. |
@charismatic-claire I agree that multiget is the way to go, but please take note that multiget does not return one big vcf file, but a WebDav like 207-multistatus response with individual vcfs. See https://tools.ietf.org/html/rfc6352#section-8.7.1 :) |
@georgehrke @charismatic-claire |
@skjnldsv |
Well, you could adapt the VCFExportPlugin to allow appending |
then build a blob from the report request and trigger a redirect to the blob? @charismatic-claire you're right on the point yes! @charismatic-claire could you then adapt this behavior to the contacts app? :) |
@skjnldsv I'll be glad to help :-) |
5f2b244
to
5387c87
Compare
@georgehrke done! :) |
@MorrisJobke @rullzer @ChristophWurst a little review for the php? |
7dbac88
to
101e3f7
Compare
Is this plugin even needed now? The discussion above – esp #12004 (comment) and #12004 (comment) – tells me this might not be required if I understand correctly. |
@ChristophWurst I updated the plugin to use the multi-get like @georgehrke said :) If you do a multiget with ?export at the end, it will return a vcf file and not a dav response ;) curl 'https://dev.skjnldsv.com/remote.php/dav/addressbooks/users/admin/contacts/?export' \
-X REPORT --user 'admin:admin' \
--data-binary '<x1:addressbook-multiget xmlns:x1="urn:ietf:params:xml:ns:carddav"><x0:prop xmlns:x0="DAV:"><x0:getcontenttype/><x0:getetag/><x0:resourcetype/><x0:displayname/><x0:owner/><x0:resourcetype/><x0:sync-token/><x0:current-user-privilege-set/><x0:getcontenttype/><x0:getetag/><x0:resourcetype/><x1:address-data/></x0:prop><x0:href xmlns:x0="DAV:">83F18885-8FF6-4839-9D10-C997D5BD9B96.vcf</x0:href><x0:href xmlns:x0="DAV:">470623A2-0FCB-4BA0-A6D2-6C25F4113C02.vcf</x0:href></x1:addressbook-multiget>' |
@ChristophWurst Maybe every pull request should start with a comprehensive description of the "ticket" we are trying to solve here. I'll try to briefly summarize what we wanted to achieve:
Does that make clear what we want and why we need this plugin on the server side? Feel free to ask, if not :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And please squash all commits :)
2267cf1
to
f18ee7c
Compare
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
f18ee7c
to
60d8b56
Compare
Thank you, @charismatic-claire ✌️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine, I guess 🐘
Failure unrelated |
@charismatic-claire @brjhaverkamp
This plugin allow us to
POSTGET a list of vcards as a multi dimensional array and retrieve everything as a single vcf file. Needed for nextcloud/contacts#39To discuss:
shall we go with a GET instead?DONEshall we use a simple array instead of a multi dimensional one?DONE