File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
src/Services/Assets/Components Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -70,23 +70,15 @@ public function save()
7070 if (request ()->hasFile ($ fileId )) {
7171 $ file = request ()->file ($ fileId );
7272 if (! $ file ->isValid ()) {
73- $ errorResponse = new LayoutResponse ;
73+ abort ( 500 , ' SVG file is not valid ' ) ;
7474
75- $ errorResponse ->addAction (new Toast ($ file ->getErrorMessage (), 'error ' ));
76-
77- return $ errorResponse ->build ();
7875 }
7976 }
8077
8178 $ sanitizer = new Sanitizer ;
82- $ cleanSVG = $ sanitizer ->sanitize ($ file );
83-
84- if (! $ cleanSVG ) {
85- $ errorResponse = new LayoutResponse ;
86-
87- $ errorResponse ->addAction (new Toast ('SVG could not be sanitized ' , 'error ' ));
88-
89- return $ errorResponse ->build ();
79+ $ cleanSVG = $ sanitizer ->sanitize (file_get_contents ($ file ->path ()));
80+ if ($ cleanSVG === false ) {
81+ abort (500 , 'SVG could not be sanitized ' );
9082 }
9183
9284 $ filename = $ this ->recordId .'.svg ' ;
You can’t perform that action at this time.
0 commit comments