Skip to content

Converter::updateCard unconditionally *adds* image to user vCard #26242

@shtrom

Description

@shtrom

Steps to reproduce

  1. use the user_ldap plugin (which updates the avatar from LDAP after each login: https://github.com/owncloud/user_ldap/blob/master/lib/User/User.php#L474-L483)
  2. set a user image in LDAP
  3. watch as the PHOTO field is repeatedly added to the user's vCard blob in oc_cards, until the database can hold no more (triggering Truncate Doctrine\DBAL\Exception\DriverException message if too long doctrine/dbal#2523 in passing)

Expected behaviour

Only one PHOTO field is present in the vCard

Actual behaviour

Duplicate PHOTO fields keep getting added to the user's vCard

Cause

Converter::updateCard unconditionally adds the given photo to the vCard, rather than replace it:

if($this->propertyNeedsUpdate($vCard, 'PHOTO', $image)) {
$vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType()]);
$updated = true;
}
; probably a missing unset($vCard->PHOTO);?

Server configuration

Operating system: OpenBSD 6.0

Web server: apache-httpd-2.4.23

Database: MySQL (mariadb-server-10.0.25p0v1)

PHP version: php-5.6.23p0

ownCloud version: (see ownCloud admin page) 9.0.2

Updated from an older ownCloud or fresh install: updated

Where did you install ownCloud from: OpenBSD ports

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions