File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 3636use OCP \Files \SimpleFS \ISimpleFolder ;
3737use OCP \ILogger ;
3838use Sabre \CardDAV \Card ;
39+ use Sabre \VObject \Document ;
3940use Sabre \VObject \Parameter ;
4041use Sabre \VObject \Property \Binary ;
4142use Sabre \VObject \Reader ;
@@ -206,9 +207,28 @@ private function getExtension(ISimpleFolder $folder): string {
206207 throw new NotFoundException ('Avatar not found ' );
207208 }
208209
210+ /**
211+ * @param Card $node
212+ * @return bool|array{body: string, Content-Type: string}
213+ */
209214 private function getPhoto (Card $ node ) {
210215 try {
211216 $ vObject = $ this ->readCard ($ node ->get ());
217+ return $ this ->getPhotoFromVObject ($ vObject );
218+ } catch (\Exception $ e ) {
219+ $ this ->logger ->logException ($ e , [
220+ 'message ' => 'Exception during vcard photo parsing '
221+ ]);
222+ }
223+ return false ;
224+ }
225+
226+ /**
227+ * @param Document $vObject
228+ * @return bool|array{body: string, Content-Type: string}
229+ */
230+ public function getPhotoFromVObject (Document $ vObject ) {
231+ try {
212232 if (!$ vObject ->PHOTO ) {
213233 return false ;
214234 }
You can’t perform that action at this time.
0 commit comments