spohlenz / tinymce-rails

Integration of TinyMCE with the Rails asset pipeline
Other
815 stars 256 forks source link

Fix when tinymce-rails-langs assets conflicted with tinymce-rails-imageupload assets #237

Closed madding closed 6 years ago

madding commented 6 years ago

When in project installed both gems tinymce-rails-langs and tinymce-rails-imageupload assets compiling with exception:

ArgumentError: same file: .../releases/20180213063815/public/assets/tinymce/plugins/uploadimage/langs/de-58e6b2b476b85cf7b8e8cc4251560977.js and .../releases/20180213063815/public/assets/tinymce/plugins/uploadimage/langs/de.js

It's happened because lang file already exists in assets folder. I'm check files and skipping move if files equal.

spohlenz commented 6 years ago

Thank you for the pull request.

I’ve been trying to find the deeper issue at play here, since FileUtils.mv in most cases should not throw an error when the destination file already exists. Where it does throw an error is when the destination exists and is symlinked to the source file, which can happen when switching from the :compile installation method to the :copy method.

I think a simpler solution for this will be to simply call FileUtils.rm(dest, force: true) if File.exist?(dest) before each move attempt.

madding commented 6 years ago

You're right, i fixed it.