It was not considering that cherrypy.request.app.script_name may be an
empty string (which happens when accessing a Wok tab and server_root is
not defined).
And that was leading to set a wrong last page cookie like
"/#/tabs/settings.html" (with an extra /) that does not correspond to
any tab content. That way, no matter on what Wok page was the last
page visited, the user would be always redirected to the default one
(which was the first Wok tab - because that the problem was not found before).
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/wok/root.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/wok/root.py b/src/wok/root.py
index 279ca7f..a0323f9 100644
--- a/src/wok/root.py
+++ b/src/wok/root.py
@@ -116,8 +116,8 @@ class Root(Resource):
# template to save the delay of the extra get to the guest page
# For that, the tab template needs to know the correct path to ui files
paths = cherrypy.request.app.root.paths
- script_name = cherrypy.request.app.script_name
- last_page = script_name.lstrip("/") + "/tabs/" + page[:-5]
+ script_name = cherrypy.request.app.script_name or "/"
+ last_page = os.path.join(script_name, "tabs/",
page[:-5]).lstrip("/")
data = {}
data['ui_dir'] = paths.ui_dir
--
2.9.3