File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
lib/public/Collaboration/Reference Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -191,8 +191,14 @@ private function fetchReference(Reference $reference): void {
191191 if (in_array ($ contentType , self ::ALLOWED_CONTENT_TYPES , true ) && $ contentLength < self ::MAX_CONTENT_LENGTH ) {
192192 $ stream = Utils::streamFor ($ response ->getBody ());
193193 $ bodyStream = new LimitStream ($ stream , self ::MAX_CONTENT_LENGTH , 0 );
194+ $ content = $ bodyStream ->getContents ();
195+
196+ if ($ contentType === 'image/svg+xml ' && stripos (html_entity_decode ($ content , ENT_XML1 ), 'XSL/Transform ' ) !== false ) {
197+ return ;
198+ }
199+
194200 $ reference ->setImageContentType ($ contentType );
195- $ folder ->newFile (md5 ($ reference ->getId ()), $ bodyStream -> getContents () );
201+ $ folder ->newFile (md5 ($ reference ->getId ()), $ content );
196202 $ reference ->setImageUrl ($ this ->urlGenerator ->linkToRouteAbsolute ('core.Reference.preview ' , ['referenceId ' => md5 ($ reference ->getId ())]));
197203 }
198204 } catch (\Exception $ e ) {
You can’t perform that action at this time.
0 commit comments