diff --git a/src/Ui/UiRequest.py b/src/Ui/UiRequest.py index 66d53463..efac19be 100644 --- a/src/Ui/UiRequest.py +++ b/src/Ui/UiRequest.py @@ -350,12 +350,25 @@ class UiRequest(object): return is_html_file + @helper.encodeResponse + def formatRedirect(self, url): + return """ + + + Redirecting to {0} + + + + """.format(html.escape(url)) + # - Actions - # Redirect to an url def actionRedirect(self, url): self.start_response('301 Redirect', [('Location', str(url))]) - yield b"Location changed: " + url.encode("utf8") + yield self.formatRedirect(url) def actionIndex(self): return self.actionRedirect("/" + config.homepage) diff --git a/src/util/helper.py b/src/util/helper.py index 5383e5a3..61455b08 100644 --- a/src/util/helper.py +++ b/src/util/helper.py @@ -338,7 +338,7 @@ def cmp(a, b): return (a > b) - (a < b) -def encodeResponse(func): +def encodeResponse(func): # Encode returned data from utf8 to bytes def wrapper(*args, **kwargs): back = func(*args, **kwargs) if "__next__" in dir(back):