hexapdf 0.15.1 → 0.15.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a6ef1bdd17664ef0b9474b931d31ad69c57c77928ce2b69a3bbd5dadda0dce6
|
4
|
+
data.tar.gz: 11b87436d19cc5498fd6a77f0b6c410e717809264153964668be0f5199b9354d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 525a55832758b5eecd1a7f2daf5f220e1afa7ff8e88ca2d65998e658585f290ff2018450e50423f2331b7f195865eab8b1c62562ecdbf3671b46d4da770aed12
|
7
|
+
data.tar.gz: 0b0e18c7f79f0e2a54080fefad1dd4d94e15157f72e5360a3ebd827fc0cc2037ae6e06302155426e7f0900e97ee0cee678e069bd8ef05a9333d684c50e1343a5
|
data/CHANGELOG.md
CHANGED
@@ -240,6 +240,18 @@ module HexaPDF
|
|
240
240
|
end
|
241
241
|
end
|
242
242
|
|
243
|
+
def decrypt(obj) #:nodoc:
|
244
|
+
if obj.type == :Metadata && obj == document.catalog.value[:Metadata] && !dict[:EncryptMetadata]
|
245
|
+
obj
|
246
|
+
else
|
247
|
+
super
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
def encrypt_stream(obj) #:nodoc
|
252
|
+
obj == document.catalog.value[:Metadata] && !dict[:EncryptMetadata] ? obj.stream_encoder : super
|
253
|
+
end
|
254
|
+
|
243
255
|
private
|
244
256
|
|
245
257
|
# Prepares the security handler for use in encrypting the document.
|
data/lib/hexapdf/version.rb
CHANGED
@@ -292,4 +292,30 @@ describe HexaPDF::Encryption::StandardSecurityHandler do
|
|
292
292
|
@handler.set_up_encryption(permissions: perms)
|
293
293
|
assert_equal([:copy_content, :modify_content], @handler.permissions.sort)
|
294
294
|
end
|
295
|
+
|
296
|
+
describe "handling of metadata streams" do
|
297
|
+
before do
|
298
|
+
@doc = HexaPDF::Document.new
|
299
|
+
@doc.encrypt(encrypt_metadata: false)
|
300
|
+
@output = StringIO.new(''.b)
|
301
|
+
end
|
302
|
+
|
303
|
+
it "doesn't decrypt or encrypt the document level metadata stream if /EncryptMetadata is false" do
|
304
|
+
@doc.catalog[:Metadata] = @doc.wrap({Type: :Metadata, Subtype: :XML}, stream: "HELLODATA")
|
305
|
+
@doc.write(@output)
|
306
|
+
assert_match(/stream\nHELLODATA\nendstream/, @output.string)
|
307
|
+
|
308
|
+
doc = HexaPDF::Document.new(io: @output)
|
309
|
+
assert_equal('HELLODATA', doc.catalog[:Metadata].stream)
|
310
|
+
end
|
311
|
+
|
312
|
+
it "doesn't modify decryption/encryption for arbitrary metadata streams" do
|
313
|
+
@doc.catalog[:Anything] = @doc.wrap({Type: :Metadata, Subtype: :XML}, stream: "HELLODATA")
|
314
|
+
@doc.write(@output)
|
315
|
+
refute_match(/stream\nHELLODATA\nendstream/, @output.string)
|
316
|
+
|
317
|
+
doc = HexaPDF::Document.new(io: @output)
|
318
|
+
assert_equal('HELLODATA', doc.catalog[:Anything].stream)
|
319
|
+
end
|
320
|
+
end
|
295
321
|
end
|
data/test/hexapdf/test_writer.rb
CHANGED
@@ -40,7 +40,7 @@ describe HexaPDF::Writer do
|
|
40
40
|
219
|
41
41
|
%%EOF
|
42
42
|
3 0 obj
|
43
|
-
<</Producer(HexaPDF version 0.15.
|
43
|
+
<</Producer(HexaPDF version 0.15.2)>>
|
44
44
|
endobj
|
45
45
|
xref
|
46
46
|
3 1
|
@@ -72,7 +72,7 @@ describe HexaPDF::Writer do
|
|
72
72
|
141
|
73
73
|
%%EOF
|
74
74
|
6 0 obj
|
75
|
-
<</Producer(HexaPDF version 0.15.
|
75
|
+
<</Producer(HexaPDF version 0.15.2)>>
|
76
76
|
endobj
|
77
77
|
2 0 obj
|
78
78
|
<</Length 10>>stream
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hexapdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Leitner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cmdparse
|