Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#12 Content-Type-Autodetection for put_object-request

Enhancement_request
closed-fixed
Michal Ludvig
s3cmd (118)
5
2008-02-11
2008-01-15
Martin Herr
No

Hi,

I found out that the -m option of s3cmd for automated mime-type-scanning doesn't work - correct?

Just add some lines to S3.py at line 178 (function object_put):

content_type = mimetypes.guess_type(filename)[0]
if not content_type:
content_type = 'text/plain'
headers["content-type"] = content_type

You'll also have to include the mimetypes-python library at the beginning of the script:

import mimetypes

Now, just recompile/install the S3-module width "python setup.py install" and s3cmd will use pythons mimetype-detection and set the correct "content-type" header for S3-contents.

Best,
maerr

Discussion

  • Martin Herr
    Martin Herr
    2008-01-15

     
    Attachments
  • Martin Herr
    Martin Herr
    2008-01-15

    • summary: Content-Types for PUT-request --> Content-Type-Autodetection for put_object-request
     
  • Michal Ludvig
    Michal Ludvig
    2008-02-11

    Logged In: YES
    user_id=344740
    Originator: NO

    Fixed in SVN now. Thanks for the report.

     
  • Michal Ludvig
    Michal Ludvig
    2008-02-11

    • assigned_to: nobody --> ludvigm
    • status: open --> closed-fixed