mirror of
https://github.com/moparisthebest/SickRage
synced 2025-03-03 01:52:02 -05:00
Fix for sickragetv/sickrage-issues#157 - force redirect to home if 404 http error.
This commit is contained in:
parent
c65b17d09b
commit
3060757381
@ -155,7 +155,7 @@ class BaseHandler(RequestHandler):
|
||||
# handle 404 http errors
|
||||
if status_code == 404:
|
||||
url = self.request.uri
|
||||
if self.request.uri.startswith(sickbeard.WEB_ROOT):
|
||||
if sickbeard.WEB_ROOT and self.request.uri.startswith(sickbeard.WEB_ROOT):
|
||||
url = url[len(sickbeard.WEB_ROOT) + 1:]
|
||||
|
||||
if url[:3] != 'api':
|
||||
@ -209,8 +209,8 @@ class WebHandler(BaseHandler):
|
||||
def get(self, route, *args, **kwargs):
|
||||
try:
|
||||
# route -> method obj
|
||||
route = route.strip('/').replace('.', '_') or 'index'
|
||||
method = getattr(self, route)
|
||||
route = route.strip('/').replace('.', '_')
|
||||
method = getattr(self, route, self.index)
|
||||
|
||||
# process request async
|
||||
self.async_call(method, callback=self.async_done)
|
||||
|
@ -26,7 +26,7 @@ class SRWebServer(threading.Thread):
|
||||
self.options.setdefault('log_dir', None)
|
||||
self.options.setdefault('username', '')
|
||||
self.options.setdefault('password', '')
|
||||
self.options.setdefault('web_root', None)
|
||||
self.options.setdefault('web_root', '/')
|
||||
assert isinstance(self.options['port'], int)
|
||||
assert 'data_root' in self.options
|
||||
|
||||
|
@ -2017,6 +2017,9 @@ class RedirectHandler(RequestHandler):
|
||||
(r"/oldpath", web.RedirectHandler, {"url": "/newpath"}),
|
||||
])
|
||||
"""
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(RedirectHandler, self).__init__(*args, **kwargs)
|
||||
|
||||
def initialize(self, url, permanent=True):
|
||||
self._url = url
|
||||
self._permanent = permanent
|
||||
|
Loading…
x
Reference in New Issue
Block a user