changeset 732:dfd9f5ee4622

serve: Fix some problems with trailing slashes.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 01 Jun 2016 22:11:29 -0700
parents dafb7d76c2ba
children 40aaec6d1d85
files piecrust/serving/util.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/serving/util.py	Wed Jun 01 22:11:05 2016 -0700
+++ b/piecrust/serving/util.py	Wed Jun 01 22:11:29 2016 -0700
@@ -48,6 +48,10 @@
 
 
 def get_requested_page(app, req_path):
+    # Remove the trailing slash to simplify how we parse URLs.
+    if req_path != '/':
+        req_path = req_path.rstrip('/')
+
     # Try to find what matches the requested URL.
     routes = find_routes(app.routes, req_path)