samuelneff / MimeTypeMap

Provides a huge dictionary of file extensions to mime types.
MIT License
625 stars 201 forks source link

Add option to make get extension return empty instead of always throw exception on unfound type #58

Closed bjarmuz closed 7 years ago

bjarmuz commented 7 years ago

Add option to NOT throw an error if mimeType is not registered.

samuelneff commented 7 years ago

Thank you for your contribution. I'd request a minor change before merging.

Adding an optional parameter this was is not compatible with already-compiled clients. If someone updates this code and uses it with clients that are not recompiled, they will get an exception about the method not being found. Optional arguments are filled in at compile time.

Instead please add overload that accepts the optional boolean and have the existing method keep its signature and call the overload appropriately.

Sam

bjarmuz commented 7 years ago

Fair enough, I've submitted a change :) Cheers!

samuelneff commented 7 years ago

Thanks for the contribution and making that change.