libis-format 1.2.5 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19055f943473fa0d2a9a1fdebf499c87652fcab845239a4b1f21341229ad08ad
4
- data.tar.gz: f6f64bcaf5472f0e11aceb2cbe97b3f367b0ed4ccc4dfc389e5857f191c59897
3
+ metadata.gz: 703d88e70d66ce9cc627d87f933393c63fd73d02e39c747ffe35233286d88bdc
4
+ data.tar.gz: a11d05c5f03dae0fcfd31c1c38511febf2344decc2c7e548e521afa6ffd5c54f
5
5
  SHA512:
6
- metadata.gz: 7b0ee24177c3f541a8cd12733e04a04649d03b2785c68c8eaa44ca3fdebd7c657346afc9a824d59e872666bfa3a657483b00b6126970cc739ef8433889621847
7
- data.tar.gz: 0bdbc5a928d6e556a816f65d05f2151e6b6ac331de37ce2d12030ace291f2b4cae452420236d9d5371f3566a7346f60854976dc33181e17549663b8ada5302f6
6
+ metadata.gz: 1d4b2ec090f1e03330926040c8238da70b77c4af578b81a82456507a46bceeef7a9edbc91919191f6928f4903e2e6b81862ae4fd6b21221d73848039e7ad3bea
7
+ data.tar.gz: 2b6d4040121d50e088566a878439ce2dde1b0805f06fcb727e9b58812f8ab9751b2747c01187025d0baa0582e9b40f853f21474531a58de2ee83827f365d9265
@@ -49,7 +49,7 @@ module Libis
49
49
  target_format = options.delete(:to_html) ? :HTML : :PDF
50
50
  result = msg_to_pdf(msg, target, target_format, options)
51
51
  msg.close
52
- return result
52
+ result
53
53
  end
54
54
 
55
55
  def msg_to_pdf(msg, target, target_format, pdf_options, reraise: false)
@@ -139,26 +139,28 @@ module Libis
139
139
  body.gsub!(IMG_CID_PLAIN_REGEX) do |match|
140
140
  # puts "CID found: #{match}, looking for #{$1}"
141
141
  data = getAttachmentData(attachments, $1)
142
- unless data
143
- # puts "cid #{$1} not found"
144
- return '<img src=""/>'
145
- end
142
+ if data
146
143
  # puts "cid #{$1} data: #{data.inspect}"
147
- used_files << $1
148
- "<img src=\"data:#{data[:mime_type]};base64,#{data[:base64]}\"/>"
144
+ used_files << $1
145
+ "<img src=\"data:#{data[:mime_type]};base64,#{data[:base64]}\"/>"
146
+ else
147
+ # puts "cid #{$1} not found"
148
+ '<img src=""/>'
149
+ end
149
150
  end
150
151
 
151
152
  # Then process HTML img tags with CID entries
152
153
  body.gsub!(IMG_CID_HTML_REGEX) do |match|
153
154
  # puts "CID found: #{match}, looking for #{$1}"
154
155
  data = getAttachmentData(attachments, $1)
155
- unless data
156
- # puts "cid #{$1} not found"
157
- return ''
158
- end
156
+ if data
159
157
  # puts "cid #{$1} data: #{data.inspect}"
160
158
  used_files << $1
161
159
  "data:#{data[:mime_type]};base64,#{data[:base64]}"
160
+ else
161
+ # puts "cid #{$1} not found"
162
+ ''
163
+ end
162
164
  end
163
165
 
164
166
  # Create PDF
@@ -196,7 +198,7 @@ module Libis
196
198
  # ----------------
197
199
  outdir = File.join(outdir, "#{File.basename(target)}.attachments")
198
200
  digits = ((attachments.count + 1)/ 10) + 1
199
- i = 0
201
+ i = 1
200
202
  attachments.delete_if {|a| a.properties.attachment_hidden}.each do |a|
201
203
  prefix = "#{"%0*d" % [digits, i]}-"
202
204
  if sub_msg = a.instance_variable_get(:@embedded_msg)
@@ -285,7 +287,7 @@ module Libis
285
287
  }
286
288
  end
287
289
  end
288
- return nil
290
+ nil
289
291
  end
290
292
 
291
293
  def read_header(headers_file)
@@ -1,5 +1,5 @@
1
1
  module Libis
2
2
  module Format
3
- VERSION = '1.2.5'
3
+ VERSION = '1.2.6'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libis-format
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kris Dekeyser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-28 00:00:00.000000000 Z
11
+ date: 2023-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake