Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace mimemagic with marcel #54

Merged
merged 9 commits into from
May 28, 2021
Merged

Conversation

ghiculescu
Copy link

@ghiculescu ghiculescu commented Mar 26, 2021

Resolves #53

See also rails/marcel#30, https://weblog.rubyonrails.org/2021/3/26/marcel-upgrade-releases/, carrierwaveuploader/carrierwave#2551

Known breaking changes

lib/paperclip.rb Show resolved Hide resolved
@pboling
Copy link

pboling commented Mar 26, 2021

NOTE:
mimemagic may have broader support for filetypes than marcel. The 0.3.7 release (now up to 0.3.10 & 0.4.3) of mimemagic fixed our deploys with current kt-paperclip (as well as the licensing issues).

This was our commit message, which shows how simple it is to upgrade for MacOS and Linux users:

fix: Update mimemagic gem to MIT-licensed release v0.3.7

• Depend on pre-installed shared-mime-info (GPLv2+)
• Update nokogori 1.11.1 => 1.11.2 (forced)

LOCAL DEV HAS NEW DEPENDENCY

brew install shared-mime-info
bundle install

DEPLOYED ENVS HAVE NEW DEPENDENCY

apt-get install shared-mime-info
bundle install

@ghiculescu
Copy link
Author

If this repo is sticking with mimemagic (particularly if Rails isn't), I think some instructions on how to install it and shared-mine-info would be helpful. My preference is to replace it with something that has no extra dependencies.

@EthanZeigler
Copy link

Sadly for people using containerized builds or cloudfoundry systems, adding another system dependency can be a real pain in the butt, especially for larger organizations with lots of red tape trying to maintain legacy software

@ghiculescu ghiculescu marked this pull request as draft March 26, 2021 20:10
@pboling
Copy link

pboling commented Mar 26, 2021

Would it be possible / reasonable to make it user choice on which library to use? Mostly just wondering academically, as for my personal use case it doesn't much matter, but I know there are implementations that utilize the underlying mime library as a first-class dependency, and would require much work to switch, if it became necessary.

Granted it's likely not necessary for most, as both can sit side-by-side... but for a workflow on top of kt-paperclip that reaches back down to the mime library, it could theoretically be painful.

I know, super edge case... I'll disappear again. Cheers! Thanks for keeping paperclip alive! We need it :)

@ghiculescu
Copy link
Author

I would be open to it. Out of curiosity, are you using this gem with Rails or independently? Rails just made the same transition https://weblog.rubyonrails.org/2021/3/26/marcel-upgrade-releases/

@pboling
Copy link

pboling commented Mar 26, 2021

Our use case is a legacy Grape (not Rails) app that does load some of the Rails gems, like ActiveRecord, ActiveSupport and ActionMailer (@ v5.2).

Also sorry for ninja edits...

@ghiculescu ghiculescu marked this pull request as ready for review March 26, 2021 20:57
@ghiculescu
Copy link
Author

Gotcha. I think it would be possible, but would rather just keep a single dependency in this PR to keep it simple. Could you please test your app against the PR as it sits now? If it causes issues I can fix them before it's merged :)

@pboling
Copy link

pboling commented Mar 27, 2021

Yep, I will test it soon.

@EthanZeigler
Copy link

Are there any updates on getting this merged? This is the last blocker for my team to release a fix for all this.

@pboling
Copy link

pboling commented Mar 28, 2021

@EthanZeigler Have you tested this branch in your app to see if it works? They were waiting on feedback from an integrated environment. I was planning to test it yesterday but had to manage a different hotfix.

@pboling
Copy link

pboling commented Mar 28, 2021

@ghiculescu is the build failure concerning?

@EthanZeigler
Copy link

I'll be able to get my team to test it tomorrow.

@ghiculescu
Copy link
Author

ghiculescu commented Mar 28, 2021

@ghiculescu is the build failure concerning?

It was the same failure on master, so I don't think this PR is causing it. But 5305f6d should fix it. Edit: it improved things but there's still some failures, which don't seem related to this PR.

@ghiculescu
Copy link
Author

I've added a list of known breaking changes we came across while testing this internally. Please let me know if there's others to add to the PR + changelog.

@geoffharcourt
Copy link

@ghiculescu thanks for opening this PR and for beginning the list of potentially breaking changes. FWIW, office documents were broken using the shared-mime-info database alone (being identified as ZIP files, probably due to the underlying structure of MS Office files as zipped XML bundles), so they are likely already broken for anyone using one of the post-yank versions of mimemagic.

@berniechiu
Copy link

we're also eager to have this merged~

@ghiculescu
Copy link
Author

Thanks @rocket-turtle - I added it to the PR body.

@Liboul
Copy link

Liboul commented Mar 30, 2021

@ghiculescu

For anyone else subscribed to this: please test this fork in your apps - at least in CI - and let me know if it works

Our CI passed. Tested in a production environment, and all 5 of our uses for Paperclip seem to keep working fine 👌

Adding the dependency to shared-mime-info is a no go for us, not only because it is an additional external dependency, environment dependent, but also because it is increasing the time to setup the project on macOS by 30 minutes. So we will be using this branch until it is merged or another solution is released. Thanks!

@natematykiewicz
Copy link

rails/marcel#36 was merged yesterday. Be on the lookout for a version bump.

@EmmaB
Copy link

EmmaB commented Apr 1, 2021

Passes CI for us (not tested in production though) saving image files and .xlsx (application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) files to a bucket on S3, on Rails 6.1.3.1. Many thanks for the work!

@ghiculescu
Copy link
Author

rails/marcel#36 was merged yesterday. Be on the lookout for a version bump.

Great. @rocket-turtle wanna see if this fixes your issues?

@johnnyshields
Copy link

johnnyshields commented Apr 2, 2021

At TableCheck we have also used this branch for several days with no issues processing 1,000+ uploads in various formats each day.

Looks like Marcel 1.0.1 is now out. How can we get this PR merged and released?

@rocket-turtle
Copy link

@ghiculescu looks good.

@cajuncanuck
Copy link

I've also been using this in an application handling various filetypes and haven't come across any issues.

@johnnyshields
Copy link

Guys lets get this one to the finish line... 🏁

@pankajbatra
Copy link

eagerly waiting for the merge ⏳

@johnnyshields
Copy link

@ssinghi can you handle this merge? It's a critical one. I've been running this in production now for over 3 weeks.

Copy link

@CaptainAwesomeDi CaptainAwesomeDi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can bump this to 1.0.1 now

paperclip.gemspec Outdated Show resolved Hide resolved
Co-authored-by: Di Wu <3957339+CaptainAwesomeDi@users.noreply.github.com>
@marcelcarousel
Copy link

Eager to have this merged

@agieche
Copy link

agieche commented May 2, 2021

Running this on production (Rails 6.1.3.1) for several weeks now without issues. Mainly handling sound files with substantial file reprocessing. Thanks for your commitment 👍

@lucasintel
Copy link

lucasintel commented May 2, 2021

Also running this in production (on multiple Rails services, from v5.2.5 to v6.1.3.1) for over 3 weeks. I haven't come across any issues.

@johnnyshields
Copy link

@adrianmann please merge this

@adrianmann
Copy link

adrianmann commented May 6, 2021

@johnnyshields Merge what? I don't have privileges to merge anything anyways.

@johnnyshields
Copy link

@ssinghi ?

@mark-brooks-roostify
Copy link

Will someone be merging this? This is a pretty important update.

@ghiculescu
Copy link
Author

For anyone else subscribed to this: please test this fork in your apps - at least in CI - and let me know if it works, or if you come across any issues worth documenting in the PR body. Here's a gemfile line to test it:

gem "kt-paperclip", git: "https://github.com/ghiculescu/kt-paperclip.git", branch: "use-marcel" # pending https://github.com/kreeti/kt-paperclip/pull/54

Bumping this for anyone who missed it. We have been running this branch in production for a few months, it's 👍 .

I think the test failures are intermittent.

@edward-ellis
Copy link

We have been running with no issues since April 4, 2021. - https://buildingenergyscore.energy.gov

@geoffharcourt
Copy link

geoffharcourt commented May 25, 2021

Same here, zero issues since early April 2021.

@ssinghi ssinghi self-assigned this May 27, 2021
@ssinghi ssinghi requested a review from sbhawsingka May 27, 2021 17:17
@ssinghi
Copy link

ssinghi commented May 27, 2021

Thank you for this PR, we'll get it reviewed soon and work on it.

@ssinghi ssinghi merged commit 5a7cb0f into kreeti:master May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plans for mimemagic problem?