Merge pull request #61017 from nextcloud/fix/use-card-interface
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Psalm static code analysis / changes (push) Waiting to run
Psalm static code analysis / static-code-analysis (push) Blocked by required conditions
Psalm static code analysis / static-code-analysis-security (push) Blocked by required conditions
Psalm static code analysis / static-code-analysis-ocp (push) Blocked by required conditions
Psalm static code analysis / static-code-analysis-ncu (push) Blocked by required conditions
Psalm static code analysis / static-code-analysis-strict (push) Blocked by required conditions
Psalm static code analysis / static-code-analysis-summary (push) Blocked by required conditions

fix: use card interface instead of object
This commit is contained in:
Sebastian Krupinski 2026-06-12 10:08:59 -04:00 committed by GitHub
commit 0ef2f4046d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 9 deletions

View file

@ -9,7 +9,7 @@ declare(strict_types=1);
namespace OCA\DAV\CardDAV;
use Sabre\CardDAV\Card;
use Sabre\CardDAV\ICard;
use Sabre\DAV\INode;
use Sabre\DAV\PropFind;
use Sabre\DAV\Server;
@ -43,7 +43,7 @@ class HasPhotoPlugin extends ServerPlugin {
public function propFind(PropFind $propFind, INode $node) {
$ns = '{http://nextcloud.com/ns}';
if ($node instanceof Card) {
if ($node instanceof ICard) {
$propFind->handle($ns . 'has-photo', function () use ($node) {
$vcard = Reader::read($node->get());
return $vcard instanceof VCard

View file

@ -10,7 +10,7 @@ namespace OCA\DAV\CardDAV;
use OCP\AppFramework\Http;
use OCP\Files\NotFoundException;
use Sabre\CardDAV\Card;
use Sabre\CardDAV\ICard;
use Sabre\DAV\Server;
use Sabre\DAV\ServerPlugin;
use Sabre\HTTP\RequestInterface;
@ -64,7 +64,7 @@ class ImageExportPlugin extends ServerPlugin {
$path = $request->getPath();
$node = $this->server->tree->getNodeForPath($path);
if (!$node instanceof Card) {
if (!$node instanceof ICard) {
return true;
}

View file

@ -15,7 +15,7 @@ use OCP\Files\SimpleFS\ISimpleFile;
use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\Image;
use Psr\Log\LoggerInterface;
use Sabre\CardDAV\Card;
use Sabre\CardDAV\ICard;
use Sabre\VObject\Document;
use Sabre\VObject\Parameter;
use Sabre\VObject\Property\Binary;
@ -43,7 +43,7 @@ class PhotoCache {
/**
* @throws NotFoundException
*/
public function get(int $addressBookId, string $cardUri, int $size, Card $card): ISimpleFile {
public function get(int $addressBookId, string $cardUri, int $size, ICard $card): ISimpleFile {
$folder = $this->getFolder($addressBookId, $cardUri);
if ($this->isEmpty($folder)) {
@ -68,7 +68,7 @@ class PhotoCache {
/**
* @throws NotPermittedException
*/
private function init(ISimpleFolder $folder, Card $card): void {
private function init(ISimpleFolder $folder, ICard $card): void {
$data = $this->getPhoto($card);
if ($data === false || !isset($data['Content-Type'])) {
@ -168,10 +168,10 @@ class PhotoCache {
}
/**
* @param Card $node
* @param ICard $node
* @return false|array{body: string, Content-Type: string}
*/
private function getPhoto(Card $node) {
private function getPhoto(ICard $node) {
try {
$vObject = $this->readCard($node->get());
return $this->getPhotoFromVObject($vObject);