From b9308407b22bc922bf8def9f7c260c70f9f90728 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Tue, 24 Jan 2023 20:18:16 -0500 Subject: [PATCH] Make webui return correct mimetypes for css and js files. --- main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 8a4b761c..20193f82 100644 --- a/main.py +++ b/main.py @@ -294,7 +294,12 @@ class PromptServer(BaseHTTPRequestHandler): out[x] = info self.wfile.write(json.dumps(out).encode('utf-8')) elif self.path[1:] in os.listdir(self.server.server_dir): - self._set_headers() + if self.path[1:].endswith('.css'): + self._set_headers(ct='text/css') + elif self.path[1:].endswith('.js'): + self._set_headers(ct='text/javascript') + else: + self._set_headers() with open(os.path.join(self.server.server_dir, self.path[1:]), "rb") as f: self.wfile.write(f.read()) else: