Commits

sempr committed fb93b4d

MOD: filetypes

  • Participants
  • Parent commits 690e1fa

Comments (0)

Files changed (2)

         if len(r[0])>0:
             file_url = r[0][0]['file_url']
             the_file = r[0][0]
-            self.set_header("Content-Type", the_file['content_type'])
-            self.set_header('Content-Disposition','attachment; filename=%s'%the_file['filename'])
-            self.set_header('Content-Length', the_file['file_size'])
+            suffix = the_file['filename'][-3:].lower()
+            if suffix not in set(['png','jpg','gif']):
+                self.set_header('Content-Disposition','attachment; filename=%s'%the_file['filename'])
+                self.set_header('Content-Length', the_file['file_size'])
+            else:
+                self.set_header("Content-Type", 'image/%s'%suffix)
             f = open(the_file['file_path'],'rb')
             self.write(f.read())
             f.close()

File templates/wait.html

 	<link rel="stylesheet" href="/static/css/mobile.css" media="all" type="text/css" />
 	<script type="text/javascript" src="http://a.tbcdn.cn/libs/jquery/1.7.1/jquery.js"></script>
 	<script type="text/javascript" src="/static/js/json.js"></script>
+	<script type="text/javascript" src="/static/js/script.js"></script>
 </head>
 <script type="text/javascript" src="/static/js/sockjs-0.3.min.js"></script>
 <script type="text/javascript">