fix: cache_ttl config validation; ticket_web_url via tojson in base.html
- app.py: wrap int(cache_ttl) in try/except so a misconfigured non-integer value falls back to 3600 instead of raising ValueError - base.html: use Jinja2 tojson filter for ticket_web_url to ensure proper JS string escaping regardless of URL contents Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -543,7 +543,11 @@ def api_avatar():
|
||||
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')
|
||||
cache_ttl = int(ldap_cfg.get('cache_ttl', 3600))
|
||||
try:
|
||||
cache_ttl = int(ldap_cfg.get('cache_ttl', 3600))
|
||||
except (ValueError, TypeError):
|
||||
logger.warning('Invalid cache_ttl in ldap config; using default 3600')
|
||||
cache_ttl = 3600
|
||||
|
||||
now = time.time()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user