diff options
author | Georg Ehrke <developer@georgehrke.com> | 2016-06-27 21:26:56 +0200 |
---|---|---|
committer | Thomas Müller <DeepDiver1975@users.noreply.github.com> | 2016-06-27 21:26:56 +0200 |
commit | 3c399be6ecf70fccc3a55fe6c60c5dfc8a7cb1ac (patch) | |
tree | 6df4161053304f7fc966253b1fe3c140fd68c558 /apps/dav/lib/CardDAV/ImageExportPlugin.php | |
parent | f8fa031e9f81ba052930d2de647d997af3c309c6 (diff) | |
download | nextcloud-server-3c399be6ecf70fccc3a55fe6c60c5dfc8a7cb1ac.tar.gz nextcloud-server-3c399be6ecf70fccc3a55fe6c60c5dfc8a7cb1ac.zip |
fix a ImageExportPlugin Test (#25215)
Diffstat (limited to 'apps/dav/lib/CardDAV/ImageExportPlugin.php')
-rw-r--r-- | apps/dav/lib/CardDAV/ImageExportPlugin.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/dav/lib/CardDAV/ImageExportPlugin.php b/apps/dav/lib/CardDAV/ImageExportPlugin.php index 3f505222491..fcd36b3ff35 100644 --- a/apps/dav/lib/CardDAV/ImageExportPlugin.php +++ b/apps/dav/lib/CardDAV/ImageExportPlugin.php @@ -108,8 +108,18 @@ class ImageExportPlugin extends ServerPlugin { $photo = $vObject->PHOTO; $type = $this->getType($photo); - $valType = $photo->getValueType(); - $val = ($valType === 'URI' ? $photo->getRawMimeDirValue() : $photo->getValue()); + $val = $photo->getValue(); + if ($photo->getValueType() === 'URI') { + $parsed = \Sabre\URI\parse($val); + //only allow data:// + if ($parsed['scheme'] !== 'data') { + return false; + } + if (substr_count($parsed['path'], ';') === 1) { + list($type,) = explode(';', $parsed['path']); + } + $val = file_get_contents($val); + } return [ 'Content-Type' => $type, 'body' => $val |