vendredi 22 mai 2015

How to upload an svg to AWS S3 using Carrierwave?

I'm trying to upload an svg to AWS s3 in a rails application. Minimagick is being used to edit the images. I've added svg to my whitelist of extensions. Carrierwave is used to upload the images and Fog is used to connect to s3.

When I try to upload this the server log shows this:

    Started POST "/works" for ::1 at 2015-05-22 21:38:30 -0400
    Processing by WorksController#create as HTML
      Parameters: {"utf8"=>"✓", "authenticity_token"=>"4j5bImtR8dws52vJ+Pt4lFnfj8Wt5Nn+e1HEMr0Q8u/pxz1rNqDMOSm3n/xGkr2PEXMSLS49Lq0IMXqsoPgVgg==", 
"work"=>{"name"=>"foobar", "github"=>"foobar", "uri"=>"foobar", "role"=>"foobar", "technologies"=>"foobar", "description"=>"foobar", 
"screenshots"=>#<ActionDispatch::Http::UploadedFile:0x007f90cb1f9ab0 @tempfile=#<Tempfile:/var/folders/9k/cwvqf93d18n8lknkbhj6zyyh0000gn/T/RackMultipart20150522-11807-1l0xzhy.svg>, 
@original_filename="blocipedia.svg", @content_type="image/svg+xml",
@headers="Content-Disposition: form-data; name=\"work[screenshots]\";
filename=\"blocipedia.svg\"\r\nContent-Type: image/svg+xml\r\n">,
"screenshots_cache"=>""}, "commit"=>"Save"}
    Unpermitted parameter: screenshots_cache
       (0.1ms)  begin transaction
       (0.0ms)  rollback transaction
    Redirected to http://localhost:3000/
    Completed 302 Found in 9ms (ActiveRecord: 0.2ms)

I see that the content type header is set to svg+xml so I'm not sure why I'm receiving errors when I try to upload an svg file.




Aucun commentaire:

Enregistrer un commentaire