From 081a4b46432cd165a233ede023b94f6b03a12399 Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 22 Jun 2012 22:30:07 +0200 Subject: [PATCH] Redirect fix --- couchpotato/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/couchpotato/__init__.py b/couchpotato/__init__.py index c3b1bd8..38b3617 100644 --- a/couchpotato/__init__.py +++ b/couchpotato/__init__.py @@ -72,7 +72,11 @@ def page_not_found(error): url = request.path[len(index_url):] if url[:3] != 'api': - return redirect(request.url.replace(request.path, index_url + '#' + url)) + if request.path != '/': + r = request.url.replace(request.path, index_url + '#' + url) + else: + r = '%s%s' % (request.url.rstrip('/'), index_url + '#' + url) + return redirect(r) else: time.sleep(0.1) return 'Wrong API key used', 404