changeset 3065:b3230c0da598

Possible fix for #196
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Tue, 31 Oct 2017 17:14:23 +0000
parents a504a17dcf9f
children aae564b49b5a
files python/pythonServer.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/python/pythonServer.py	Tue Oct 31 16:44:53 2017 +0000
+++ b/python/pythonServer.py	Tue Oct 31 17:14:23 2017 +0000
@@ -69,16 +69,19 @@
         st = s.path.rsplit(',')
         lenSt = len(st)
         fmt = st[lenSt-1].rsplit('.')
+        fmt = fmt[len(fmt)-1]
+        print(st)
+        print(fmt)
         fpath = "../"+urllib2.unquote(s.path)
         size = os.path.getsize(fpath)
-        fileDump = open(fpath)
+        fileDump = open(fpath, mode='rb')
         s.send_response(200)
 
-        if (fmt[1] == 'html'):
+        if (fmt == 'html'):
             s.send_header("Content-type", 'text/html')
-        elif (fmt[1] == 'css'):
+        elif (fmt == 'css'):
             s.send_header("Content-type", 'text/css')
-        elif (fmt[1] == 'js'):
+        elif (fmt == 'js'):
             s.send_header("Content-type", 'application/javascript')
         else:
             s.send_header("Content-type", 'application/octet-stream')