paperclip-webmerge 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8f6abbc6698c4131b6557f6c22006be00ca0713
4
- data.tar.gz: 4cb92d7fd9605cf7271d07143100e9d141191870
3
+ metadata.gz: b795930f146a50111f9bdde3f02d6408d6ba971f
4
+ data.tar.gz: 8588ae9a7e332563de12f2f618ce35dac8e08e64
5
5
  SHA512:
6
- metadata.gz: f04e61dd84e9218a6eb0723aa910266bd1dfde5ac6c80f9bd735095d2795806f600d9ef3518e2785a52ce56325588a1eb0874f04324e8aa96c364b692181ff10
7
- data.tar.gz: ce14e3963b14fd479d1e9b932427be2e5850b5f8d0cab29588e73686a862aee79baaf5bd7014fde9bce250ceed39f027315e1bc35d2b83150fd5d0b758970855
6
+ metadata.gz: e38cb89f1d4643823d9a47596cb0cb498cfbef252238c1f3b9320abba29b031ae5c74acfed07f353aa588ea7820b38ccabba1efdddf54e076879c7e0c68ac016
7
+ data.tar.gz: e75fb3dbfbd00199f57d03d6c20ef60e3770a3658eb9fb38f9a9870855d15b6fa345fc92880c101227eaa81f543fd6db67422150a8d0beaecf12b0c06b4f130d
@@ -1,4 +1,5 @@
1
1
  require 'paperclip_web_merge/version'
2
+ require 'ostruct'
2
3
  require 'web_merge'
3
4
 
4
5
  module Paperclip
@@ -48,6 +49,9 @@ module Paperclip
48
49
  end
49
50
 
50
51
  def file_type(file)
52
+ correct_file_type = MIME::Types.type_for(file.path).first.to_s
53
+ file = OpenStruct.new(content_type: correct_file_type) if ['application/zip', 'application/octect-stream'].include?(file.content_type)
54
+
51
55
  {
52
56
  'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx',
53
57
  'application/pdf' => 'pdf',
@@ -56,8 +60,6 @@ module Paperclip
56
60
  'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx',
57
61
  'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx',
58
62
  'application/vnd.ms-powerpoint' => 'pptx',
59
- 'application/zip' => -> { MIME::Types.type_for(file.path).first.to_s },
60
- 'application/octet-stream' => -> { MIME::Types.type_for(file.path).first.to_s }
61
63
  }[file.content_type]
62
64
  end
63
65
 
@@ -1,7 +1,7 @@
1
1
  module Paperclip
2
2
  module Storage
3
3
  module WebMerge
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip-webmerge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Plicque
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-06 00:00:00.000000000 Z
11
+ date: 2017-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler