Currently, almost any uploaded file is considered 'application/octet-stream' by the web server, which prevents the browser to handle it correctly and force it to be downloaded.
The problem lies with the way the python SimpleHTTPServer handles files, by default, it serves anything as a binary blob, except for .c, .h, and .py files which are considered plain text.
Theoretically, it should read the default mimetype files from the system and use that to find out the mimetype to give for an extension, but it does not seem to work.
So you just have to get a complete mimetypes file from your system (here is mine), add it to your piratebox (like in /etc/ or whatever), and fix the python code so that it reads it, by modifying the /mnt/ext/usr/lib/python2.6/SimpleHTTPServer.py file at line 202,
change
A cleaner way would be to create a class that inherits SimpleHTTPServer, but since the python on the piratebox isn’t meant to be updated or used by anything else, I am not sure it is worth the effort.
Currently, almost any uploaded file is considered 'application/octet-stream' by the web server, which prevents the browser to handle it correctly and force it to be downloaded.
The problem lies with the way the python SimpleHTTPServer handles files, by default, it serves anything as a binary blob, except for .c, .h, and .py files which are considered plain text. Theoretically, it should read the default mimetype files from the system and use that to find out the mimetype to give for an extension, but it does not seem to work.
So you just have to get a complete mimetypes file from your system (here is mine), add it to your piratebox (like in /etc/ or whatever), and fix the python code so that it reads it, by modifying the /mnt/ext/usr/lib/python2.6/SimpleHTTPServer.py file at line 202, change
with
And it should work (also, my SimpleHTTPServer.py).
A cleaner way would be to create a class that inherits SimpleHTTPServer, but since the python on the piratebox isn’t meant to be updated or used by anything else, I am not sure it is worth the effort.