Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 08543ac25a |
@@ -10,6 +10,7 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import tempfile
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
@@ -458,7 +459,7 @@ def api_avatar():
|
|||||||
|
|
||||||
# Build a safe cache filename from the username (alphanumeric + - _ .)
|
# Build a safe cache filename from the username (alphanumeric + - _ .)
|
||||||
safe_name = re.sub(r'[^a-zA-Z0-9._-]', '_', username)
|
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)
|
os.makedirs(cache_dir, exist_ok=True)
|
||||||
cache_file = os.path.join(cache_dir, f'user_{safe_name}.jpg')
|
cache_file = os.path.join(cache_dir, f'user_{safe_name}.jpg')
|
||||||
sentinel = os.path.join(cache_dir, f'user_{safe_name}.none')
|
sentinel = os.path.join(cache_dir, f'user_{safe_name}.none')
|
||||||
|
|||||||
Reference in New Issue
Block a user