Giter Club home page Giter Club logo

Comments (8)

adamcrown avatar adamcrown commented on June 17, 2024

I'd like to see a solution to this too. Currently I'm having to inject a bogus application/extension content type into my base64 string just to get the extension I want.

I'd think something like this as an alternative would make sense as a default with an option to override it maybe.

MIME::Types['application/vnd.openxmlformats-officedocument.wordprocessingml.document'].first.preferred_extension #=> "docx"

from carrierwave-base64.

Quintasan avatar Quintasan commented on June 17, 2024

@adamcrown Thanks for looking into that. I'll try to take a stab at it this weekend.

from carrierwave-base64.

y9v avatar y9v commented on June 17, 2024

How about passing a name of the file in the payload with the upload?

from carrierwave-base64.

Quintasan avatar Quintasan commented on June 17, 2024

from carrierwave-base64.

y9v avatar y9v commented on June 17, 2024

@Quintasan @adamcrown I made a commit, that adds automatic identification of the file extension, using the content type from the uploaded base64 string: c93c690.

If you have time, I would like you to test it. If it's fine, I will release a 2.4.0 version, including this change.

from carrierwave-base64.

y9v avatar y9v commented on June 17, 2024

Ok, I think I can already release the 2.4.0

from carrierwave-base64.

adamcrown avatar adamcrown commented on June 17, 2024

@lebedev-yury Sorry I'm so very late to this. I've just now had time to revisit this issue. Just wanted to let you know that it's working great. Thanks.

If anybody else stumbles on this and wonders how to add custom mime types. The documentation isn't great for the mime-types gem, but this is what worked for me

MIME::Types.add(
  MIME::Type.new('application/icml').tap {
    |type| type.add_extensions 'icml'
  }
)

from carrierwave-base64.

y9v avatar y9v commented on June 17, 2024

@adamcrown thank you! I will add this information to the readme

from carrierwave-base64.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.