Commits

sempr committed 069849e

MOD: add content-type for others

Comments (0)

Files changed (1)

             the_file = r[0][0]
             suffix = the_file['filename'][-3:].lower()
             if suffix not in set(['png','jpg','gif']):
+                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'])
             else:
                 self.set_header("Content-Type", 'image/%s'%suffix)
+            self.set_header('Content-Length', the_file['file_size'])
             f = open(the_file['file_path'],'rb')
             self.write(f.read())
             f.close()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.