valid_email2 6.0.0 → 7.0.0

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: a0296ec313cffb7390cb7ca2b22d48f15854bbb1cc8dc1442b31389b7350f31b
4
- data.tar.gz: 11da87b6097bdc4df988d16045809dc42336b68b2f4fdf087a1ad38013619061
3
+ metadata.gz: 18dccc719c18b67299952ce4096d4b1c0184810985015dacfc883d7b7dcb021f
4
+ data.tar.gz: c3a7f37eceb1dde232850accbd1fed04ba73cff1a899d4f12762f54d2d88a533
5
5
  SHA512:
6
- metadata.gz: e6003807039faf5c307d53b2617adcc5c0a0e75055f560e48073ea9cc1d5093f50aba58f2cbe121cc913b99ba8df62789e11a59d236cd0b13b17ad800925e5a5
7
- data.tar.gz: 981042cfa3c8a72f101ba40a3922a0a3c2c2aa26ea0635ac4beb0ce59917171ec0ff1126dde68c77edb42939e4618372960c88645f720ad588e6735a2c392baf
6
+ metadata.gz: b5276142248e94cc178345e6ea069fb1675003bd2aa011a732287b0cae349f0e43c2fe8a855080550286b373b0fec3359658555efb4b4de0cec0d22a2fff6f2e
7
+ data.tar.gz: '087ae98e571ac2eb9acbb0e1230f19e090f577d44e2d0eba75feb7fa2aeafa391848cb8eb86aca95c38e22a99b099ed702206f9bfa7232e6f4356a66ecceb040'
@@ -1 +1 @@
1
- {".":"6.0.0"}
1
+ {".":"7.0.0"}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [7.0.0](https://github.com/micke/valid_email2/compare/v6.0.0...v7.0.0) (2024-11-19)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * revert allowing scandinavian characters by making allowed multibyte characters configurable ([#261](https://github.com/micke/valid_email2/issues/261))
9
+
10
+ ### Bug Fixes
11
+
12
+ * revert allowing scandinavian characters by making allowed multibyte characters configurable ([#261](https://github.com/micke/valid_email2/issues/261)) ([cf6a1e9](https://github.com/micke/valid_email2/commit/cf6a1e9e28f78e0c6f3e3ea7e9160bf9194b45e6))
13
+
3
14
  ## [6.0.0](https://github.com/micke/valid_email2/compare/v5.3.0...v6.0.0) (2024-11-03)
4
15
 
5
16
 
data/README.md CHANGED
@@ -128,6 +128,12 @@ address.valid_strict_mx? => true
128
128
  address.subaddressed? => false
129
129
  ```
130
130
 
131
+ If you want to allow multibyte characters, set it explicitly.
132
+
133
+ ```ruby
134
+ ValidEmail2::Address.permitted_multibyte_characters_regex = /[ÆæØøÅåÄäÖöÞþÐð]/
135
+ ```
136
+
131
137
  ### Test environment
132
138
 
133
139
  If you are validating `mx` then your specs will fail without an internet connection.
@@ -85654,6 +85654,7 @@ kwa-law.com
85654
85654
  kwa.xyz
85655
85655
  kwacollections.com
85656
85656
  kwadratowamaskar.pl
85657
+ kwalah.com
85657
85658
  kwalidd.cf
85658
85659
  kwangjinmold.com
85659
85660
  kwanj.ml
@@ -168874,4 +168875,4 @@ zzzmail.pl
168874
168875
  zzzpush.icu
168875
168876
  zzzz1717.com
168876
168877
  zzzzzzzzzzzzz.com
168877
- zzzzzzzzzzzzz.com0-00.usa.cc
168878
+ zzzzzzzzzzzzz.com0-00.usa.cc
@@ -3,7 +3,6 @@
3
3
  require "valid_email2"
4
4
  require "resolv"
5
5
  require "mail"
6
- require "unicode/emoji"
7
6
  require "valid_email2/dns_records_cache"
8
7
 
9
8
  module ValidEmail2
@@ -22,6 +21,14 @@ module ValidEmail2
22
21
  @prohibited_domain_characters_regex = val
23
22
  end
24
23
 
24
+ def self.permitted_multibyte_characters_regex
25
+ @permitted_multibyte_characters_regex
26
+ end
27
+
28
+ def self.permitted_multibyte_characters_regex=(val)
29
+ @permitted_multibyte_characters_regex = val
30
+ end
31
+
25
32
  def initialize(address, dns_timeout = 5, dns_nameserver = nil)
26
33
  @parse_error = false
27
34
  @raw_address = address
@@ -34,7 +41,7 @@ module ValidEmail2
34
41
  @parse_error = true
35
42
  end
36
43
 
37
- @parse_error ||= address_contain_emoticons?
44
+ @parse_error ||= address_contain_multibyte_characters?
38
45
  end
39
46
 
40
47
  def valid?
@@ -130,10 +137,12 @@ module ValidEmail2
130
137
  }
131
138
  end
132
139
 
133
- def address_contain_emoticons?
140
+ def address_contain_multibyte_characters?
134
141
  return false if @raw_address.nil?
135
142
 
136
- @raw_address.scan(Unicode::Emoji::REGEX).length >= 1
143
+ return false if @raw_address.ascii_only?
144
+
145
+ @raw_address.each_char.any? { |char| char.bytesize > 1 && char !~ self.class.permitted_multibyte_characters_regex }
137
146
  end
138
147
 
139
148
  def resolv_config
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal:true
2
2
 
3
3
  module ValidEmail2
4
- VERSION = "6.0.0"
4
+ VERSION = "7.0.0"
5
5
  end
data/spec/address_spec.rb CHANGED
@@ -34,9 +34,25 @@ describe ValidEmail2::Address do
34
34
  expect(address.valid?).to be false
35
35
  end
36
36
 
37
- it "is valid if it contains special scandinavian characters" do
37
+ it "is invalid if it contains Japanese characters" do
38
+ address = described_class.new("あいうえお@example.com")
39
+ expect(address.valid?).to be false
40
+ end
41
+
42
+ it "is invalid if it contains special scandinavian characters" do
38
43
  address = described_class.new("jørgen@email.dk")
39
- expect(address.valid?).to eq true
44
+ expect(address.valid?).to eq false
45
+ end
46
+
47
+ context "permitted_multibyte_characters_regex is set" do
48
+ before do
49
+ described_class.permitted_multibyte_characters_regex = /[ÆæØøÅåÄäÖöÞþÐð]/
50
+ end
51
+
52
+ it "is valid if it contains special scandinavian characters" do
53
+ address = described_class.new("jørgen@email.dk")
54
+ expect(address.valid?).to eq true
55
+ end
40
56
  end
41
57
  end
42
58
 
data/valid_email2.gemspec CHANGED
@@ -28,5 +28,4 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency "pry"
29
29
  spec.add_runtime_dependency "mail", "~> 2.5"
30
30
  spec.add_runtime_dependency "activemodel", ">= 6.0"
31
- spec.add_runtime_dependency "unicode-emoji", "~> 3.7.0"
32
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valid_email2
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 7.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micke Lisinge
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-03 00:00:00.000000000 Z
11
+ date: 2024-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -122,20 +122,6 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '6.0'
125
- - !ruby/object:Gem::Dependency
126
- name: unicode-emoji
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: 3.7.0
132
- type: :runtime
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: 3.7.0
139
125
  description: ActiveModel validation for email. Including MX lookup and disposable
140
126
  email deny list
141
127
  email: