aboutsummarybugs & patchesrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVosjedev <vosje@vosjedev.net>2026-01-24 15:26:54 +0100
committerVosjedev <vosje@vosjedev.net>2026-01-24 15:26:54 +0100
commite12579bff3c80a5da2f1cf0e24fb0eb32731580c (patch)
tree7014feaa8e3d656ed5beb098e29367a067d0012c /src
parent54529c14f308b7f9e84cbe8c6c14ad85c2ed613d (diff)
downloaddiscord_image_bridge-e12579bff3c80a5da2f1cf0e24fb0eb32731580c.tar.gz
discord_image_bridge-e12579bff3c80a5da2f1cf0e24fb0eb32731580c.tar.bz2
discord_image_bridge-e12579bff3c80a5da2f1cf0e24fb0eb32731580c.tar.xz
utils: don't try to create existing directories
Signed-off-by: Vosjedev <vosje@vosjedev.net>
Diffstat (limited to 'src')
-rw-r--r--src/discord_image_bridge/utils.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/discord_image_bridge/utils.py b/src/discord_image_bridge/utils.py
index 838e9c6..55a2b14 100644
--- a/src/discord_image_bridge/utils.py
+++ b/src/discord_image_bridge/utils.py
@@ -16,7 +16,8 @@ def download_and_cache(url, filename):
if resp.status_code==200:
hash=do_hash(resp.content).hexdigest()
try:
- os.mkdir(hash[:2])
+ if not os.path.isdir(hash[:2]):
+ os.mkdir(hash[:2])
fname=os.path.join(hash[:2],hash)
with open(fname,'wb') as fd:
fd.write(resp.content)