Actions
Bug #693
closedSloppy WApplication::internalPathMatches()
Start date:
01/19/2011
Due date:
% Done:
0%
Estimated time:
Description
WApplication::internalPathMatches() is sloppy to match a path:
Updated by Koen Deforche almost 15 years ago
- Status changed from InProgress to Resolved
 
Should be fixed in latest git. This can easily be back-ported to earlier versions:
diff --git a/src/Wt/WApplication.C b/src/Wt/WApplication.C
index 8f01690..96994ac 100644
--- a/src/Wt/WApplication.C
+++ b/src/Wt/WApplication.C
@@ -950,8 +950,11 @@ bool WApplication::internalPathMatches(const std::string& path) const
 bool WApplication::pathMatches(const std::string& path,
                               const std::string& query)
 {
-  if (query.length() <= path.length()
-      && path.substr(0, query.length()) == query)
+  /* Returns whether the current path start with the query */
+  if (query == path
+      || (path.length() > query.length()
+         && path.substr(0, query.length()) == query
+         && (query[query.length() - 1] == '/' || path[query.length()] == '/')))
     return true;
   else
     return false;
Updated by Koen Deforche over 14 years ago
- Status changed from Resolved to Closed
 
Actions