You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: