Permalink
Browse files

allow '-' for the value (ex: CD-DA)

  • Loading branch information...
1 parent d6bf1c1 commit 339c2b35f51edf52c2d6cb753a2544935e1dbc50 @arton committed Apr 5, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/UPnP/control/service.rb
@@ -148,6 +148,11 @@ def screen_data(data)
end
##
+ # value permitted chars
+
+ VALUE_PATTERN = /\A[-\w:]*\z/
+
+ ##
# Hash mapping UPnP Actions to arguments
#
# {
@@ -347,7 +352,7 @@ def parse_allowed_value_list(state_variable)
list.css('allowedValue').each do |value|
value = value.text.strip
- raise Error, "insecure allowed value #{value}" unless value =~ /\A\w*\z/
+ raise Error, "insecure allowed value #{value}" unless value =~ VALUE_PATTERN
values << value
end
@@ -405,7 +410,7 @@ def parse_service_state_table(service_state_table)
if default && default.txt then
default = default.text.strip
raise Error, "insecure default value #{default}" unless
- default =~ /\A[\w:]*\z/
+ default =~ VALUE_PATTERN
end
allowed_value_list = parse_allowed_value_list var

0 comments on commit 339c2b3

Please sign in to comment.