blobsterix 0.0.26 → 0.0.27

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: 9c1ccaa89590b6d492dba453da8542afefc08124
4
- data.tar.gz: 19c382d5d80ef77df7d7c0e23da3a424c388cf4a
3
+ metadata.gz: 68fb2005862b18ec60e73f2864bad3eb88b9bd4c
4
+ data.tar.gz: 1ac5546d2811121064aaf564b30342dfb8b911a9
5
5
  SHA512:
6
- metadata.gz: c214ea2f03ee07768760061ad63f17b1be168bff2c329e9e9a5cb6b1c562cb9bbabc7f4abbe27b9bc2dc99b702b05db1c236865ddeb04364e8bc8a533c073c38
7
- data.tar.gz: fbddb19069fba7915b18bf9de8e7fa02f60ae9fcba3bf5a4fa4b4a309c25927e3e2edeb19d7889284187b11994c08f7a4045cb85f5c84fb3b78a6cbac1b63a5d
6
+ metadata.gz: 40889006e4d459f5d62a9828175a37ffa804b96e14d8692f64cb91df9362e0d0f8a599df3b070f0f85866ce7901a95005431a71f9d921d50bd140ec0e76d64f9
7
+ data.tar.gz: cf49a09033e107cf4070e8739c586ff4a2d4bb0e9bdb89812874a24102f45cd70aea6862bad495a2053e8eb686982e01d80c6662cb2cb28cac2201c560667876
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,5 @@
1
+ = 0.0.27
2
+ * added mimetype recognition by extension for zip files
1
3
  = 0.0.26
2
4
  * bug fix
3
5
  = 0.0.25
@@ -75,7 +75,7 @@ module Blobsterix
75
75
  end
76
76
 
77
77
  def payload
78
- @payload
78
+ @payload||={}
79
79
  end
80
80
 
81
81
  def write
@@ -119,16 +119,22 @@ module Blobsterix
119
119
  end
120
120
 
121
121
  def as_json
122
- {'mimetype' => mimetype, 'mediatype' => mediatype, 'etag' => etag, 'size' => size,'payload' => @payload.to_json}
122
+ {'mimetype' => mimetype, 'mediatype' => mediatype, 'etag' => etag, 'size' => size,'payload' => payload.to_json}
123
123
  end
124
124
 
125
125
  private
126
+ def mime_path
127
+ unzip_trafo = (payload[:trafo].select do |t|
128
+ t[0] == "unzip"
129
+ end if payload && payload[:trafo]) || [[nil,nil]]
130
+ (unzip_trafo[0][1] if unzip_trafo[0]) || path
131
+ end
126
132
  def meta_path
127
133
  @meta_path ||= "#{path}.meta"
128
134
  end
129
135
 
130
136
  def get_mime
131
- @mimeclass ||= (MimeMagic.by_magic(File.open(path)) if File.exists?(path) )|| MimeMagic.new("text/plain")
137
+ @mimeclass ||= (MimeMagic.by_path(mime_path) || ((MimeMagic.by_magic(File.open(path)) if File.exists?(path)) ) || MimeMagic.new("text/plain"))
132
138
  end
133
139
  def save_meta_file
134
140
  return if not valid
@@ -1,3 +1,3 @@
1
1
  module Blobsterix
2
- VERSION = "0.0.26"
2
+ VERSION = "0.0.27"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blobsterix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Sudmann