dap 0.1.12 → 0.1.13
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/lib/dap/filter/simple.rb +3 -0
- data/lib/dap/version.rb +1 -1
- data/spec/dap/filter/simple_filter_spec.rb +17 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10ae22bb408cf78181b05417d5989e6d7596beab
|
4
|
+
data.tar.gz: 1ae46bda652b7d9762fc783c405a41f0b283a640
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cbc7962e20e455b61827704fb30aae75e017133b75db1a01a2c78bcfd52bf357684c75eb4e501c779779942d8c7aeb21362bfd392cd0ea76252239a358a5f2e
|
7
|
+
data.tar.gz: 8a0580e71ed75bdc907cdedba4666e7001c07e0979c4a8fcb021d5c3be1e4ddb15044a6ab8690fa5962ff501f69b1e4c542c7ba3365616f231fc910c4a934677
|
data/lib/dap/filter/simple.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'digest/sha1'
|
2
2
|
require 'digest/md5'
|
3
3
|
require 'digest/sha2'
|
4
|
+
require 'json'
|
4
5
|
|
5
6
|
module Dap
|
6
7
|
module Filter
|
@@ -238,6 +239,8 @@ class FilterTransform
|
|
238
239
|
doc[k] = doc[k].to_s.upcase
|
239
240
|
when 'ascii'
|
240
241
|
doc[k] = doc[k].to_s.gsub(/[\x00-\x1f\x7f-\xff]/n, '')
|
242
|
+
when 'json'
|
243
|
+
doc[k] = JSON.parse(doc[k].to_s)
|
241
244
|
when 'utf8encode'
|
242
245
|
doc[k] = doc[k].to_s.encode!('UTF-8', invalid: :replace, undef: :replace, replace: '')
|
243
246
|
when 'base64decode'
|
data/lib/dap/version.rb
CHANGED
@@ -196,6 +196,23 @@ describe Dap::Filter::FilterTransform do
|
|
196
196
|
end
|
197
197
|
end
|
198
198
|
end
|
199
|
+
|
200
|
+
context 'json' do
|
201
|
+
let(:filter) { described_class.new(['val=json']) }
|
202
|
+
|
203
|
+
context 'valid json' do
|
204
|
+
let(:process) { filter.process({'val' => '{"nested": "1"}'}) }
|
205
|
+
it 'is the correct JSON' do
|
206
|
+
expect(process).to eq(['val' => { 'nested' => '1' }])
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
context 'invalid json' do
|
211
|
+
it 'raises on invalid JSON' do
|
212
|
+
expect { filter.process({'val' => '{abc123'}) }.to raise_error(JSON::ParserError)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
199
216
|
end
|
200
217
|
end
|
201
218
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rapid7 Research
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -253,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
253
|
version: '0'
|
254
254
|
requirements: []
|
255
255
|
rubyforge_project:
|
256
|
-
rubygems_version: 2.
|
256
|
+
rubygems_version: 2.6.11
|
257
257
|
signing_key:
|
258
258
|
specification_version: 4
|
259
259
|
summary: 'DAP: The Data Analysis Pipeline'
|