diff --git a/app.py b/app.py index bfb5a18..2f6cd07 100644 --- a/app.py +++ b/app.py @@ -10,6 +10,7 @@ import json import logging import os import re +import tempfile import threading import time import uuid @@ -458,7 +459,7 @@ def api_avatar(): # Build a safe cache filename from the username (alphanumeric + - _ .) safe_name = re.sub(r'[^a-zA-Z0-9._-]', '_', username) - cache_dir = ldap_cfg.get('cache_dir', '/tmp/gandalf_avatars') + cache_dir = ldap_cfg.get('cache_dir', os.path.join(tempfile.gettempdir(), 'gandalf_avatars')) os.makedirs(cache_dir, exist_ok=True) cache_file = os.path.join(cache_dir, f'user_{safe_name}.jpg') sentinel = os.path.join(cache_dir, f'user_{safe_name}.none')