[tor-commits] [oonib/master] Apply the correct regular expression to the test helper key.

art at torproject.org art at torproject.org
Wed Apr 23 14:31:51 UTC 2014


commit 882095a92a9fe4123529ee05e1beaa5e2a9e4bed
Author: Arturo Filastò <art at fuffa.org>
Date:   Thu Mar 27 22:13:57 2014 +0100

    Apply the correct regular expression to the test helper key.
    
    Fixes #37
---
 oonib/report/handlers.py |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/oonib/report/handlers.py b/oonib/report/handlers.py
index dea5326..9e9e8ca 100644
--- a/oonib/report/handlers.py
+++ b/oonib/report/handlers.py
@@ -99,6 +99,7 @@ def parseNewReportRequest(request):
     version_string = re.compile("[0-9A-Za-z_\-\.]+$")
     name = re.compile("[a-zA-Z0-9_\- ]+$")
     probe_asn = re.compile("AS[0-9]+$")
+    test_helper = re.compile("[A-Za-z0-9_\-]+$")
 
     expected_request = {
      'software_name': name,
@@ -125,8 +126,8 @@ def parseNewReportRequest(request):
             raise InvalidRequestField(k)
     
     try:
-        test_helper = parsed_request['test_helper']
-        if not re.match(regexp, str(test_helper)):
+        requested_test_helper = parsed_request['test_helper']
+        if not re.match(test_helper, str(requested_test_helper)):
             raise InvalidRequestField('test_helper')
     except KeyError:
         pass





More information about the tor-commits mailing list