Skip to content

Commit 500d5d9

Browse files
committed
Update language tag validation to what BCP47 requires, not RDF, which is too libreral.
1 parent 7506695 commit 500d5d9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/rdf/model/literal.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ def has_datatype?
360360
# @return [Boolean] `true` or `false`
361361
# @since 0.2.1
362362
def valid?
363-
return false if language? && language.to_s !~ /^[a-zA-Z]+(-[a-zA-Z0-9]+)*$/
363+
return false if language? && language.to_s !~ /^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/
364364
return false if datatype? && datatype.invalid?
365365
grammar = self.class.const_get(:GRAMMAR) rescue nil
366366
grammar.nil? || value.match?(grammar)

0 commit comments

Comments
 (0)