nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.31k stars 4.06k forks source link

Dav URL ..vcf?photo does not resolve if photo is a URI #20705

Closed myrho closed 1 year ago

myrho commented 4 years ago

How to use GitHub

Steps to reproduce

  1. Assume having Nextcloud running at http://nextcloud with an addressbook testbook.
  2. Run
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_HEADER, true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
    curl_setopt($curl, CURLOPT_USERPWD, "username:password");
    curl_setopt($curl, CURLOPT_URL, "http://nextcloud/remote.php/dav/addressbooks/users/username/testbook/xyz.vcf");
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS,<<<VCARD
    BEGIN:VCARD
    VERSION:3.0
    UID:xyz
    FN:Humming Bird
    PHOTO;TYPE=JPEG;VALUE=URI:http://nextcloud/remote.php/webdav/Photos/Hummingbird.jpg
    END:VCARD
    VCARD
    ); 
    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: text/vcard'));
    echo curl_exec($curl);
  3. Try to fetch http://nextcloud/remote.php/dav/addressbooks/users/username/testbook/xyz.vcf?photo

Expected behaviour

The image should be loaded.

Actual behaviour

404 HTTP Status code is returned.

Server configuration

From the latest nextcloud docker image:

Operating system: Debian Buster

Web server: Apache

Database: Sqlite

PHP version: PHP 7.3

Nextcloud version: 18.0.4

Updated from an older Nextcloud/ownCloud or fresh install: Fresh

Where did you install Nextcloud from: Docker

List of activated apps: Contacts

Client configuration

Browser: Latest Chrome/Firefox

Logs

No error messages appear related to the ...vcf?photo request in the nextcloud logs (loglevel 0).

skjnldsv commented 4 years ago

duplicate of https://github.com/nextcloud/server/issues/20143

myrho commented 4 years ago

Why do you think this issue is a duplicate #20143?

kesselb commented 4 years ago

I don't think it's a duplicate of #20143 either :)

But using a file as photo thats stored in a users Nextcloud account is also not supported. Actually only embedded images as base64 or binary possible: https://github.com/nextcloud/server/blob/192cf12440cdca9f5c044b84a9187605a58d7707/apps/dav/lib/CardDAV/PhotoCache.php#L207

skjnldsv commented 4 years ago

Ah, I think it was because I was very tired and it was very late for me :grin: :see_no_evil: Sorryyy :hugs:

kesselb commented 4 years ago

Just to add: I'm fine with the current implementation. Adding the opportunity to embed external or internal resources by uri adds a lot of complexity. Think about all those security checks for such a feature.

myrho commented 4 years ago

It is already possible to create vcards with photo URIs and the Contacts app already displays the referenced image (at least in the contact view).

Maybe redirecting a vcf?photo url to the referenced uri would be the easiest solution? So not handling the external resource on the server at all.

skjnldsv commented 4 years ago

Maybe redirecting a vcf?photo url to the referenced uri would be the easiest solution? So not handling the external resource on the server at all.

That's a fair idea actually! Can you open a pr for it? :)

szaimen commented 1 year ago

Hi, please update to 24.0.8 or better 25.0.2 and report back if it fixes the issue. Thank you!