[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [metrics-web/master] Accept non-$-prefixed fingerprints with 20+ characters, too.
commit ecd4463bc3cc8d9b8b19f9052cea3e1b9b8e58fb
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Mon Mar 26 11:19:30 2012 +0200
Accept non-$-prefixed fingerprints with 20+ characters, too.
---
.../torproject/ernie/web/RelaySearchServlet.java | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/org/torproject/ernie/web/RelaySearchServlet.java b/src/org/torproject/ernie/web/RelaySearchServlet.java
index 01b6c6f..f361833 100644
--- a/src/org/torproject/ernie/web/RelaySearchServlet.java
+++ b/src/org/torproject/ernie/web/RelaySearchServlet.java
@@ -226,14 +226,18 @@ public class RelaySearchServlet extends HttpServlet {
/* If the search term starts with a $ followed by 8 to 40 hex
* characters, it must be a fingerprint. */
- else if (searchTerm.length() >= 9 && searchTerm.length() <= 41 &&
+ else if ((searchTerm.length() >= 9 && searchTerm.length() <= 41 &&
searchTerm.startsWith("$") &&
- hexPattern.matcher(searchTerm.substring(1)).matches()) {
+ hexPattern.matcher(searchTerm.substring(1)).matches()) ||
+ (searchTerm.length() > 19 && searchTerm.length() <= 40 &&
+ !searchTerm.startsWith("$") &&
+ hexPattern.matcher(searchTerm).matches())) {
if (searchFingerprint.length() > 0) {
validQuery = false;
break;
}
- searchFingerprint = searchTerm.substring(1);
+ searchFingerprint = searchTerm.substring(
+ (searchTerm.startsWith("$") ? 1 : 0));
validQuery = true;
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits