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

fix(dav): fall back to generated avatar in image export plugin #45408

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

st3iny
Copy link
Member

@st3iny st3iny commented May 20, 2024

  • Resolves: #

Summary

TODO

  • ...

Checklist

@st3iny st3iny added 3. to review Waiting for reviews feature: dav feature: carddav Related to CardDAV internals labels May 20, 2024
@st3iny st3iny added this to the Nextcloud 30 milestone May 20, 2024
@st3iny st3iny self-assigned this May 20, 2024
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
@st3iny st3iny force-pushed the fix/dav/image-export-plugin-fallback branch from 6f4841c to 21a5dc8 Compare May 20, 2024 12:00
@st3iny st3iny changed the title fix(dav): fall back to generated plugin in image export plugin fix(dav): fall back to generated avatar in image export plugin May 20, 2024
)));
$server->addPlugin(new \OCA\DAV\CardDAV\ImageExportPlugin(
new \OCA\DAV\CardDAV\PhotoCache(
\OC::$server->getAppDataDir('dav-photocache'),

Check notice

Code scanning / Psalm

DeprecatedMethod Note

The method OC\Server::getAppDataDir has been marked as deprecated
$avatar = $this->avatarManager->getGuestAvatar($name);
$image = $avatar->get($size);

$response->setHeader('Content-Type', $image->mimeType());

Check notice

Code scanning / Psalm

PossiblyNullArgument Note

Argument 2 of Sabre\HTTP\ResponseInterface::setHeader cannot be null, possibly null value provided
$avatar = $this->avatarManager->getGuestAvatar($name);
$image = $avatar->get($size);

$response->setHeader('Content-Type', $image->mimeType());

Check notice

Code scanning / Psalm

PossiblyFalseReference Note

Cannot call method mimeType on possibly false value
$image = $avatar->get($size);

$response->setHeader('Content-Type', $image->mimeType());
$fileName = $node->getName() . '.' . PhotoCache::ALLOWED_CONTENT_TYPES[$image->mimeType()];

Check notice

Code scanning / Psalm

PossiblyNullArrayOffset Note

Cannot access value on variable OCA\DAV\CardDAV\PhotoCache::ALLOWED_CONTENT_TYPES using possibly null offset null|string
$fileName = $node->getName() . '.' . PhotoCache::ALLOWED_CONTENT_TYPES[$image->mimeType()];
$response->setHeader('Content-Disposition', "attachment; filename=$fileName");
$response->setStatus(200);
$response->setBody($image->data());

Check notice

Code scanning / Psalm

PossiblyNullArgument Note

Argument 1 of Sabre\HTTP\ResponseInterface::setBody cannot be null, possibly null value provided
$logger)
$this->server->addPlugin(
new ImageExportPlugin(new PhotoCache(
\OC::$server->getAppDataDir('dav-photocache'),

Check notice

Code scanning / Psalm

DeprecatedMethod Note

The method OC\Server::getAppDataDir has been marked as deprecated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews feature: carddav Related to CardDAV internals feature: dav
Projects
Status: 🏗️ In progress
Development

Successfully merging this pull request may close these issues.

None yet

1 participant