[PATCH 4 of 4 prefix exploded] login: use server-relative URLs in came_from correctly

Mads Kiilerich mads at kiilerich.com
Fri Sep 18 17:27:12 UTC 2015


# HG changeset patch
# User Søren Løvborg <sorenl at unity3d.com>
# Date 1442577469 -7200
#      Fri Sep 18 13:57:49 2015 +0200
# Branch stable
# Node ID 56fdb0279a24c4ed2abb166ebc10422e6b4002c7
# Parent  ba21aaf1e89a2bd63ac4df05dc4d0ab24e1791a0
login: use server-relative URLs in came_from correctly

Using h.url to combine came_from with query parameters caused the
SCRIPT_NAME to incorrectly be prepended to came_from, even though
it was already present. This was not a problem if the Kallithea
instance was served directly from the server root ('/') as is common,
but broke setups where Kallithea was served from a prefix.

diff --git a/kallithea/controllers/login.py b/kallithea/controllers/login.py
--- a/kallithea/controllers/login.py
+++ b/kallithea/controllers/login.py
@@ -67,7 +67,7 @@ class LoginController(BaseController):
             if not self._validate_came_from(came_from):
                 log.error('Invalid came_from (not server-relative): %r', came_from)
                 raise HTTPBadRequest()
-            c.came_from = url(came_from)
+            c.came_from = came_from
         else:
             c.came_from = url('home')
 


More information about the kallithea-general mailing list