Project

General

Profile

Actions

Bug #693

closed

Sloppy WApplication::internalPathMatches()

Added by Koen Deforche almost 14 years ago. Updated almost 14 years ago.

Status:
Closed
Priority:
High
Assignee:
Target version:
-
Start date:
01/19/2011
Due date:
% Done:

0%

Estimated time:

Description

WApplication::internalPathMatches() is sloppy to match a path:

see http://redmine.emweb.be/boards/2/topics/1299

Actions #1

Updated by Koen Deforche almost 14 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;
Actions #2

Updated by Koen Deforche almost 14 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF