startback 1.2.2 → 1.2.3

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
  SHA256:
3
- metadata.gz: '0941902faa95df3393eaba4f7003e7f605b6b30850d98bd7110ad58f8dadf279'
4
- data.tar.gz: 6cb05013dd0bcad2d0c698c3c457b0645e557db1956224517c734fd7cdeafec7
3
+ metadata.gz: 7807796286047fe2edb12603e7bf130a48aaedce349a154e8124c09012d3f171
4
+ data.tar.gz: c2a5a0e7cba2a2ed6b59343654c1e3404ff2a2c09c740e657b843f290aff4ac3
5
5
  SHA512:
6
- metadata.gz: c95a2dbc26dbb0b8f782cd5c7428238a6d504d10044a2bcf4b8d3a29ac87decdd06922ca20cfed05f5d8da7f9e364752e56eeef5cbfd89d646978f001efa3aa2
7
- data.tar.gz: 577ce4755c0fafb05fd412ce5b34fac4aa592627843fe727e90073d49760d02c520d66aa90be078e62930fbc3d0e025dd7616b56be8f736f4a03d6676b2a8e31
6
+ metadata.gz: d32e019f5d4492bfa5b10b1addc6b662ac85eb0744171d803bb3a5cd1e36a4811106dfae8be0488a146ec832f2d6d5ad574bc1a2a1d0e646c96545ac15ed3ce3
7
+ data.tar.gz: 07ce0ad6fa20798f48c760c49b49640d2d52b961e08bacb0d536461ee43a8d3a1166309df9aa00c9c6af359c8dc0ff68e615c8cc4218c0b08e0a7633822ed5f1
@@ -21,8 +21,9 @@ module Startback
21
21
  }]
22
22
  when Enumerable
23
23
  data.map{|elm| redact(elm) }.compact
24
- when /:\/\//
25
- data.gsub(/:\/\/([^@]+[@])/){|m| "://--redacted--@" }
24
+ when String
25
+ return data unless data.valid_encoding?
26
+ data =~ /:\/\// ? data.gsub(/:\/\/([^@]+[@])/){|m| "://--redacted--@" } : data
26
27
  else
27
28
  data
28
29
  end
@@ -2,7 +2,7 @@ module Startback
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 2
5
- TINY = 2
5
+ TINY = 3
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
@@ -90,6 +90,19 @@ module Startback
90
90
  expect(r.redact('http://user:password@google.com/a/path')).to eql('http://--redacted--@google.com/a/path')
91
91
  end
92
92
 
93
+ it 'handles strings with invalid encoding without raising' do
94
+ binary = "hello\x80\xFF world".dup.force_encoding('UTF-8')
95
+ expect(binary.valid_encoding?).to be false
96
+ expect { redactor.redact(binary) }.not_to raise_error
97
+ expect(redactor.redact(binary)).to equal(binary)
98
+ end
99
+
100
+ it 'handles binary strings in nested structures' do
101
+ binary = "\x80\xFF".dup.force_encoding('UTF-8')
102
+ data = { foo: "bar", nested: { value: binary } }
103
+ expect { redactor.redact(data) }.not_to raise_error
104
+ end
105
+
93
106
  end # class Redactor
94
107
  end # module Support
95
108
  end # module Startback
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: startback
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-03 00:00:00.000000000 Z
11
+ date: 2026-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec