aboutsummarybugs & patchesrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVosjedev <vosje@vosjedev.net>2026-01-25 12:20:18 +0100
committerVosjedev <vosje@vosjedev.net>2026-01-25 12:20:18 +0100
commit3a3e964b53193126f8ab09ebef2dc1cb466c6217 (patch)
treead187bd5fcfcff7592606c240e3f2dbaa9bc7df2
parent6c12b9b02bafe3f83d8b409b589ccd15de8bf0f2 (diff)
downloaddiscord_image_bridge-3a3e964b53193126f8ab09ebef2dc1cb466c6217.tar.gz
discord_image_bridge-3a3e964b53193126f8ab09ebef2dc1cb466c6217.tar.bz2
discord_image_bridge-3a3e964b53193126f8ab09ebef2dc1cb466c6217.tar.xz
Handle file not found properly
Signed-off-by: Vosjedev <vosje@vosjedev.net>
-rw-r--r--src/discord_image_bridge/__init__.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/discord_image_bridge/__init__.py b/src/discord_image_bridge/__init__.py
index e0a658a..a9afc3f 100644
--- a/src/discord_image_bridge/__init__.py
+++ b/src/discord_image_bridge/__init__.py
@@ -30,6 +30,9 @@ class Root(object):
osname=fsmanager.hash2fname(hash)
if not os.path.isfile(osname):
ohash, osname=utils.download_uncached(hash)
+ if not ohash:
+ cherrypy.response.status=404
+ return "File not found"
if not ohash.startswith(hash):
cherrypy.log("Wrong hash! Expected %s, got %s"%(hash,ohash))
cherrypy.response.status=500