ndr_import 8.5.1 → 8.5.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 +4 -4
- data/CHANGELOG.md +5 -0
- data/code_safety.yml +8 -8
- data/lib/ndr_import/file/base.rb +2 -1
- data/lib/ndr_import/file/docx.rb +4 -3
- data/lib/ndr_import/file/excel.rb +2 -2
- data/lib/ndr_import/mapper.rb +1 -1
- data/lib/ndr_import/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66af1dbe18a160875b514f4b7c7bf259b6b43f0565d45beeccb87fd647a5983e
|
4
|
+
data.tar.gz: 0c2a1a0d00ab0371ef9b9d845487cd8e0b67137816b02cefbce7d554c4df6a32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93e749531fc2834866ecf83a16231b233b2800eab53a8ea1d663fa9525fc014a9f9a77b6fd93b43100fe34bbd2e435e3c77e6b4b5ce538927646ceb39c6551c1
|
7
|
+
data.tar.gz: d04b1fb034f37f6129213a1615bd7db360690ed1da9e9028990dc0bd70aeff0ac9211a2028912d89700c67907e03453d6b9cf2868b67194a450b9a14f48ca4e1
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
*no unreleased changes*
|
3
3
|
|
4
|
+
## 8.5.2 / 2019-05-17
|
5
|
+
### Fixed
|
6
|
+
* Fixed issue with `file_password` option key as a String or Symbol
|
7
|
+
* Tempfiles now take their encoding from the incoming string/stream
|
8
|
+
|
4
9
|
## 8.5.1 / 2019-05-15
|
5
10
|
### Added
|
6
11
|
* Add data loader tools (#39)
|
data/code_safety.yml
CHANGED
@@ -19,7 +19,7 @@ file safety:
|
|
19
19
|
CHANGELOG.md:
|
20
20
|
comments:
|
21
21
|
reviewed_by: josh.pencheon
|
22
|
-
safe_revision:
|
22
|
+
safe_revision: bd60b56117e65f106d7cb02e0c5772b9e5ec470e
|
23
23
|
CODE_OF_CONDUCT.md:
|
24
24
|
comments:
|
25
25
|
reviewed_by: timgentry
|
@@ -94,8 +94,8 @@ file safety:
|
|
94
94
|
safe_revision: 5cd2cd0b3a1e254d30d4acc28c6731825a1f84f5
|
95
95
|
lib/ndr_import/file/base.rb:
|
96
96
|
comments:
|
97
|
-
reviewed_by:
|
98
|
-
safe_revision:
|
97
|
+
reviewed_by: josh.pencheon
|
98
|
+
safe_revision: c3183e522bce50008df576ceb47fe4761ab8f966
|
99
99
|
lib/ndr_import/file/delimited.rb:
|
100
100
|
comments:
|
101
101
|
reviewed_by: josh.pencheon
|
@@ -103,11 +103,11 @@ file safety:
|
|
103
103
|
lib/ndr_import/file/docx.rb:
|
104
104
|
comments:
|
105
105
|
reviewed_by: josh.pencheon
|
106
|
-
safe_revision:
|
106
|
+
safe_revision: 897f8b648d633368cf2001d17ab89c06a12d445b
|
107
107
|
lib/ndr_import/file/excel.rb:
|
108
108
|
comments:
|
109
109
|
reviewed_by: josh.pencheon
|
110
|
-
safe_revision:
|
110
|
+
safe_revision: c3183e522bce50008df576ceb47fe4761ab8f966
|
111
111
|
lib/ndr_import/file/office_file_helper.rb:
|
112
112
|
comments:
|
113
113
|
reviewed_by: josh.pencheon
|
@@ -175,7 +175,7 @@ file safety:
|
|
175
175
|
lib/ndr_import/mapper.rb:
|
176
176
|
comments: Writes to a Tempfile, but cleans up. Ruby will respect TMP_DIR
|
177
177
|
reviewed_by: josh.pencheon
|
178
|
-
safe_revision:
|
178
|
+
safe_revision: 897f8b648d633368cf2001d17ab89c06a12d445b
|
179
179
|
lib/ndr_import/mapping_error.rb:
|
180
180
|
comments:
|
181
181
|
reviewed_by: timgentry
|
@@ -231,7 +231,7 @@ file safety:
|
|
231
231
|
lib/ndr_import/version.rb:
|
232
232
|
comments: another check?
|
233
233
|
reviewed_by: josh.pencheon
|
234
|
-
safe_revision:
|
234
|
+
safe_revision: bd60b56117e65f106d7cb02e0c5772b9e5ec470e
|
235
235
|
lib/ndr_import/xml/table.rb:
|
236
236
|
comments:
|
237
237
|
reviewed_by: josh.pencheon
|
@@ -543,7 +543,7 @@ file safety:
|
|
543
543
|
test/universal_importer_helper_test.rb:
|
544
544
|
comments:
|
545
545
|
reviewed_by: josh.pencheon
|
546
|
-
safe_revision:
|
546
|
+
safe_revision: c3183e522bce50008df576ceb47fe4761ab8f966
|
547
547
|
test/xml/table_test.rb:
|
548
548
|
comments:
|
549
549
|
reviewed_by: josh.pencheon
|
data/lib/ndr_import/file/base.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'active_support/core_ext/hash'
|
1
2
|
require 'ndr_support/safe_file'
|
2
3
|
require 'ndr_import/csv_library'
|
3
4
|
require_relative 'registry'
|
@@ -11,7 +12,7 @@ module NdrImport
|
|
11
12
|
def initialize(filename, format, options = {})
|
12
13
|
@filename = filename
|
13
14
|
@format = format
|
14
|
-
@options = options
|
15
|
+
@options = options.stringify_keys
|
15
16
|
|
16
17
|
validate_filename_is_safe_and_readable!
|
17
18
|
end
|
data/lib/ndr_import/file/docx.rb
CHANGED
@@ -17,7 +17,7 @@ module NdrImport
|
|
17
17
|
def rows(&block)
|
18
18
|
return enum_for(:rows) unless block
|
19
19
|
|
20
|
-
send(@options
|
20
|
+
send(@options['file_password'] ? :decrypted_path : :unencrypted_path) do |path|
|
21
21
|
doc = ::Docx::Document.open(path)
|
22
22
|
|
23
23
|
doc.paragraphs.each do |p|
|
@@ -32,8 +32,9 @@ module NdrImport
|
|
32
32
|
|
33
33
|
# This method returns the path to the temporary, decrypted file
|
34
34
|
def decrypted_path
|
35
|
-
|
36
|
-
|
35
|
+
file_string = decrypted_file_string(@filename, @options['file_password'])
|
36
|
+
Tempfile.create(['decrypted', '.docx'], encoding: file_string.encoding) do |file|
|
37
|
+
file.write(file_string)
|
37
38
|
file.close
|
38
39
|
|
39
40
|
yield file.path
|
@@ -91,8 +91,8 @@ module NdrImport
|
|
91
91
|
when '.xls'
|
92
92
|
Roo::Excel.new(SafeFile.safepath_to_string(path))
|
93
93
|
when '.xlsx'
|
94
|
-
if @options
|
95
|
-
Roo::Excelx.new(StringIO.new(decrypted_file_string(path, @options[
|
94
|
+
if @options['file_password']
|
95
|
+
Roo::Excelx.new(StringIO.new(decrypted_file_string(path, @options['file_password'])))
|
96
96
|
else
|
97
97
|
Roo::Excelx.new(SafeFile.safepath_to_string(path))
|
98
98
|
end
|
data/lib/ndr_import/mapper.rb
CHANGED
@@ -277,7 +277,7 @@ module NdrImport::Mapper
|
|
277
277
|
end
|
278
278
|
|
279
279
|
def read_docx(stream)
|
280
|
-
Tempfile.create(encoding:
|
280
|
+
Tempfile.create(encoding: stream.external_encoding) do |tempfile|
|
281
281
|
tempfile.write(stream.read)
|
282
282
|
|
283
283
|
docx = ::Docx::Document.open(tempfile.path)
|
data/lib/ndr_import/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ndr_import
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.5.
|
4
|
+
version: 8.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NCRS Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|