Skip to content
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

Contacts API: replace raw image data with url #25081

Merged
merged 6 commits into from
Jun 21, 2016

Conversation

georgehrke
Copy link
Contributor

@georgehrke georgehrke commented Jun 13, 2016

fixes #23345

  • adjust tests

@georgehrke georgehrke added this to the 9.1-current milestone Jun 13, 2016
@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @schiessle, @DeepDiver1975 and @nickvergessen to be potential reviewers

@georgehrke georgehrke force-pushed the dav_contacts_image_uri branch from dafd43b to e6d7a08 Compare June 13, 2016 14:02

return [
'routes' => [
['name' => 'photos#get', 'url' => '/contactsphoto/{addressbookId}/{contactUri}', 'verb' => 'GET'],
Copy link
Member

Choose a reason for hiding this comment

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

hmmm ... I would have built this as part of the webdav routes

please note there are only 2 public http based protocols we support: webdav and ocs api.
routes like above are considered private and should not be exposed to 3rdparty - the mail and contacts apps are treated as 3rdparty

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not so sure about the webdav route, because this change only affects the PHP based Contacts API. Adding this to the WebDAV routes would require apps like the Mail app to implement a dav client just to fetch contact images 😕

Copy link
Member

Choose a reason for hiding this comment

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

Adding this to the WebDAV routes would require apps like the Mail app to implement a dav client just to fetch contact images 😕

A GET is a GET is a GET .... 🙊

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A GET is a GET is a GET ....

Well, there is some truth to this 🙈

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there some "easy" straight forward way to register routes or do I need to write a plugin like in https://github.com/owncloud/core/blob/master/apps/dav/lib/Comments/CommentsPlugin.php#L86?

Copy link
Member

Choose a reason for hiding this comment

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

here we go ... #25121

@georgehrke georgehrke force-pushed the dav_contacts_image_uri branch from e6d7a08 to 2858111 Compare June 15, 2016 07:57
@georgehrke georgehrke force-pushed the dav_contacts_image_uri branch 2 times, most recently from 37c6655 to 77399b8 Compare June 16, 2016 08:27
@@ -103,6 +104,7 @@ public function __construct(IRequest $request, $baseUri) {
// addressbook plugins
$this->server->addPlugin(new \OCA\DAV\CardDAV\Plugin());
$this->server->addPlugin(new VCFExportPlugin());
$this->server->addPlugin(new ImageExportPlugin());
Copy link
Member

Choose a reason for hiding this comment

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

Must be added to the serverfactory as well for v1 routes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

Choose a reason for hiding this comment

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

thx

@georgehrke
Copy link
Contributor Author

please review @DeepDiver1975 @ChristophWurst @PVince81

@ChristophWurst
Copy link
Contributor

👍 nice, works!

use Sabre\VObject\Parameter;
use Sabre\VObject\Reader;

class ImageExportPlugin extends ServerPlugin {
Copy link
Member

Choose a reason for hiding this comment

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

this plugin deserves some unit tests as well 🙈

@DeepDiver1975
Copy link
Member

@ChristophWurst @Gomez did you test this with the mail app? does it work? THX

@Gomez
Copy link
Member

Gomez commented Jun 20, 2016

Yeah works in Mail! Nice @georgehrke

@DeepDiver1975 DeepDiver1975 force-pushed the dav_contacts_image_uri branch from 6aae6e9 to 72e0732 Compare June 20, 2016 21:24
//
// TODO: these three below are not working - needs debugging
//
// 'vcard 3 with PHOTO URL' => [['Content-Type' => 'image/jpeg', 'body' => '12345'], "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 3.5.0//EN\r\nUID:12345\r\nFN:12345\r\nN:12345;;;;\r\nPHOTO;TYPE=JPEG:http://example.org/photo.jpg\r\nEND:VCARD\r\n"],
Copy link
Member

Choose a reason for hiding this comment

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

@georgehrke mind debugging these 3 cases and adjust the code accordingly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I can take a look tomorrow

Copy link
Member

Choose a reason for hiding this comment

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

Thx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How is http://example.org/photo.jpg supposed to return '12345' in the first place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

anyway, 'vcard 3 with PHOTO URL' seems to be a bug in Sabre/Vobject because getValueType() returns BINARY

Copy link
Contributor Author

Choose a reason for hiding this comment

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

'vcard 4 with PHOTO URL' is fixed now

Copy link
Member

Choose a reason for hiding this comment

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

How is http://example.org/photo.jpg supposed to return '12345' in the first place?

it's not 🙈

Copy link
Member

Choose a reason for hiding this comment

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

please file issues upstream - thx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

done - fruux/sabre-vobject#325

THX

@georgehrke georgehrke force-pushed the dav_contacts_image_uri branch from 72e0732 to 836def3 Compare June 21, 2016 11:33
@DeepDiver1975
Copy link
Member

👍

@DeepDiver1975 DeepDiver1975 merged commit 1452b74 into master Jun 21, 2016
@DeepDiver1975 DeepDiver1975 deleted the dav_contacts_image_uri branch June 21, 2016 13:26
@jancborchardt
Copy link
Member

Oooh this is awesome! :) Great work!

Will it be backported as well?

@DeepDiver1975
Copy link
Member

@georgehrke please prepare backport pr - we want to make oc9 users happy as well 🙈

@georgehrke
Copy link
Contributor Author

sure

@PVince81
Copy link
Contributor

stable9: #25219

@lock
Copy link

lock bot commented Aug 5, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DAV app returns raw contact image instead of URL
7 participants