summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xfbin.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/fbin.py b/fbin.py
index f9ca772..51d3203 100755
--- a/fbin.py
+++ b/fbin.py
@@ -443,13 +443,17 @@ class Application(object):
def static(self, environ, start_response, path):
filename = path[1]
- if not filename in ('style.css', 'no-thumbnail.png'):
+ if not filename in ('style.css', 'no-thumbnail.png', 'favicon.ico'):
start_response('404 Not Found', [])
return []
+ filepath = os.path.join(settings.static_root, filename)
+ if not os.path.exists(filepath):
+ start_response('404 Not Found', [])
+ return []
mime = mimetypes.guess_type(filename, strict = False)[0] or 'application/octet-stream'
start_response('200 OK', [('Content-Type', mime)])
- return open(os.path.join(settings.static_root, filename), 'rb')
+ return open(filepath, 'rb')
def help(self, environ, start_response, path):
c = Cookie.SimpleCookie(environ['HTTP_COOKIE'] if 'HTTP_COOKIE' in environ else None)
@@ -586,6 +590,8 @@ class Application(object):
module = path[0] if len(path) else ''
if len(module) and module in 'fulshmitorcda':
return getattr(self, module)(environ, start_response, path)
+ elif path == ['favicon.ico']:
+ return self.static(environ, start_response, ['s'] + path)
else:
start_response('302 Found', [('Location', settings.virtual_root + 'u')])
return []