diff piecrust/serving/util.py @ 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 606f6d57b5df
children 673979a5d548
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)