Przeglądaj źródła

Fix incorrect mime type for javascript.

Hoto Cocoa 5 lat temu
rodzic
commit
eefdc19d9d
1 zmienionych plików z 5 dodań i 2 usunięć
  1. 5 2
      route/main_views.py

+ 5 - 2
route/main_views.py

@@ -24,11 +24,14 @@ def main_views_2(conn, name):
             if mime_type in image_type:
             if mime_type in image_type:
                 mime_type = 'image/' + mime_type
                 mime_type = 'image/' + mime_type
             else:
             else:
-                mime_type = 'text/' + mime_type
+                if mime_type == 'js':
+                    mime_type = 'text/javascript'
+                else:
+                    mime_type = 'text/' + mime_type
         else:
         else:
             mime_type = 'text/plain'
             mime_type = 'text/plain'
 
 
         return flask.send_from_directory(
         return flask.send_from_directory(
             dir_name, file_name, 
             dir_name, file_name, 
             mimetype = mime_type
             mimetype = mime_type
-        )
+        )