Hello,

I am attempting to verify my understanding of how mime type assignment works in 
s3cmd. I'm hoping this post will make this detail easier to find for others 
seeking it too.

I looked at the S3.py code and surmised that the "python-magic" module will 
attempt to be used if present. If it is not present, a warning:

"WARNING: Module python-magic is not available. Guessing MIME types based on 
file extensions."

will be issued and s3cmd will guess the mime type for application by use of the 
"mimetypes" module.

As I understand, the "mimetypes" module (which seems to be a stock python 
module) looks to the OS for a mime type mapping file and uses that to assign 
mime types to files uploaded to S3.

On my AWS linux S3 uploading host, that file seems to be /etc/mime.types, which 
appears to be a fully fledged map file and appropriate for this use.

Is this understanding accurate?

Thanks,
Mike

# python
Python 2.6.9 (unknown, Mar 28 2014, 00:06:37)
[GCC 4.8.2 20131212 (Red Hat 4.8.2-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mimetypes
>>> mimetypes.init()
>>> mimetypes.knownfiles
['/etc/mime.types', '/etc/httpd/mime.types', '/etc/httpd/conf/mime.types', 
'/etc/apache/mime.types', '/etc/apache2/mime.types', 
'/usr/local/etc/httpd/conf/mime.types', '/usr/local/lib/netscape/mime.types', 
'/usr/local/etc/httpd/conf/mime.types', '/usr/local/etc/mime.types']


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
S3tools-general mailing list
S3tools-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/s3tools-general

Reply via email to