File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 3
3
/* For licensing terms, see /license.txt */
4
4
5
5
use ChamiloSession as Session ;
6
+ use enshrined \svgSanitize \Sanitizer ;
6
7
7
8
/**
8
9
* Class DocumentManager
@@ -486,6 +487,13 @@ public static function file_send_for_download(
486
487
}
487
488
echo $ content ;
488
489
} else {
490
+ if ('image/svg+xml ' === $ contentType ) {
491
+ $ svgContent = file_get_contents ($ full_file_name );
492
+
493
+ echo (new Sanitizer ())->sanitize ($ svgContent );
494
+ return true ;
495
+ }
496
+
489
497
if (isset ($ enableMathJaxScript ) && $ enableMathJaxScript === true ) {
490
498
$ content = file_get_contents ($ full_file_name );
491
499
$ content = self ::includeMathJaxScript ($ content );
Original file line number Diff line number Diff line change @@ -1097,6 +1097,10 @@ public static function saveMessageAttachmentFile(
1097
1097
$ fileCopied = true ;
1098
1098
}
1099
1099
}
1100
+
1101
+ if ('image/svg+xml ' === $ type ) {
1102
+ sanitizeSvgFile ($ new_path );
1103
+ }
1100
1104
}
1101
1105
1102
1106
if ($ fileCopied ) {
Original file line number Diff line number Diff line change 9
9
*
10
10
* @package chamilo.messages
11
11
*/
12
+
13
+ use Symfony \Component \HttpFoundation \Request as HttpRequest ;
14
+
12
15
session_cache_limiter ('public ' );
13
16
14
17
require_once __DIR__ .'/../inc/global.inc.php ' ;
20
23
header ('Cache-Control: public ' );
21
24
header ('Pragma: no-cache ' );
22
25
23
- $ messageId = isset ($ _GET ['message_id ' ]) ? $ _GET ['message_id ' ] : 0 ;
24
- $ attachmentId = isset ($ _GET ['attachment_id ' ]) ? $ _GET ['attachment_id ' ] : 0 ;
26
+ $ httpRequest = HttpRequest::createFromGlobals ();
27
+
28
+ $ messageId = $ httpRequest ->query ->getInt ('message_id ' );
29
+ $ attachmentId = $ httpRequest ->query ->getInt ('attachment_id ' );
25
30
26
31
$ messageInfo = MessageManager::get_message_by_id ($ messageId );
27
32
$ attachmentInfo = MessageManager::getAttachment ($ attachmentId );
You can’t perform that action at this time.
0 commit comments