From f05070115cfbd0ee59d4f7b43c8b4d2e96b75265 Mon Sep 17 00:00:00 2001
From: moodler <moodler>
Date: Tue, 9 Mar 2004 06:28:01 +0000
Subject: [PATCH] If the uploaded file is HTML, then put it through the filters

---
 file.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/file.php b/file.php
index 97052b04e1..6319b44075 100644
--- a/file.php
+++ b/file.php
@@ -49,7 +49,12 @@
         header("Content-disposition: inline; filename=$filename");
         header("Content-length: ".filesize($pathname));
         header("Content-type: $mimetype");
-        readfile("$pathname");
+
+        if ($mimetype == "text/html") {
+            echo format_text(implode('', file($pathname)), FORMAT_HTML);  // Filter HTML files
+        } else {
+            readfile("$pathname");
+        }
     } else {
         error("Sorry, but the file you are looking for was not found ($pathname)", "course/view.php?id=$courseid");
     }
-- 
2.39.5