jeet1212 / awstasks

Automatically exported from code.google.com/p/awstasks
Apache License 2.0
0 stars 0 forks source link

Odd mime types after uploading #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Not sure if this is an awstasks issue, or something else, but figured I would 
report it!  I am using S3 to make a simple website hosting service, and it 
seems like files uploaded via awstasks are reported by the browser as being 
mimetype application/octet-stream.  I snapped a screenshot:

https://skitch.com/epugh/f8y8q/solrenterprisesearchserver.com

This caused problems specifically for my style.css file, it wouldn't render.  
If I upload files then using other tools like CyberDuck, the problem goes away.

Original issue reported on code.google.com by de...@yahoo.com on 28 Jun 2011 at 9:42

GoogleCodeExporter commented 8 years ago
Hi David (and anyone else who has this problem),

I am by no means a Java developer but this is the solution I found to this 
problem.

awstasks uses javax.activation.MimetypesFileTypeMap to work out mime types and 
from a quick search it seems to be limited in what mime types it recognises - 
which is why CSS and JS files are set as octect-stream.

The latest version of awstats in SVN (NOT v0.3 which is what you get from the 
download link on the homepage) includes a "mimeTypesFile" attribute where you 
can pass in a file location with a list of mime types. So checkout the latest 
version from SVN and run 'ant jar' to build the latest JAR.

So your S3Upload task my look at little like:

<S3Upload verbose="true"
    accessId="${aws.accessId}"
    secretKey="${aws.secretKey}"
    bucket="${aws.bucket}"
    publicRead="true"
    mimeTypesFile="deploy.mime.types">

then in your deploy.mime.types file:

   text/css css
   application/x-javascript js

and any other mime types that are being incorrectly set (the format is <MIME 
TYPE> <SPACE DELIMITED LIST OF FILE EXTENSIONS>).

Hope that helps,

Ed

Original comment by e...@assertivelabs.com on 22 Jan 2012 at 3:00