Skip to content

Commit 5869ca2

Browse files
committed
🚨 StringPrep: more helpful error reporting
1 parent 0304ca3 commit 5869ca2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/net/imap/sasl/stringprep.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ def self.[](table)
3232
def check_prohibited!(string, *tables, bidi: false, profile: nil)
3333
tables = TABLE_TITLES.keys.grep(/^C/) if tables.empty?
3434
tables |= %w[C.8] if bidi
35-
table = tables.find {|t| TABLE_REGEXPS[t].match?(string) }
36-
raise ProhibitedCodepoint.new(
37-
table, string: string, profile: nil
38-
) if table
35+
table = tables.find {|t| TABLE_REGEXPS.fetch(t).match?(string) }
36+
if table
37+
raise ProhibitedCodepoint.new(
38+
table, string: string, profile: nil
39+
)
40+
end
3941
check_bidi!(string, profile: profile) if bidi
4042
end
4143

0 commit comments

Comments
 (0)