about summary refs log tree commit diff
path: root/lib/paperclip/transcoder_extensions.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-07-05 22:55:09 +0200
committerGitHub <noreply@github.com>2020-07-05 22:55:09 +0200
commit94e09d309cb068ea92919767e40e655260ac43cb (patch)
tree8c41900d4f4c8a94cb5a2feee1af2080ae2dec15 /lib/paperclip/transcoder_extensions.rb
parent9b3677d5097fb50f90a6abdce9d722e81d2db469 (diff)
parent69cddc3909924b5a2ce02f85932fb41f88faf0db (diff)
Merge pull request #1371 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'lib/paperclip/transcoder_extensions.rb')
-rw-r--r--lib/paperclip/transcoder_extensions.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/paperclip/transcoder_extensions.rb b/lib/paperclip/transcoder_extensions.rb
new file mode 100644
index 000000000..c0b2447f3
--- /dev/null
+++ b/lib/paperclip/transcoder_extensions.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module Paperclip
+  module TranscoderExtensions
+    # Prevent the transcoder from modifying our meta hash
+    def initialize(file, options = {}, attachment = nil)
+      meta_value = attachment&.instance_read(:meta)
+      super
+      attachment&.instance_write(:meta, meta_value)
+    end
+  end
+end
+
+Paperclip::Transcoder.prepend(Paperclip::TranscoderExtensions)