web custom links urlquote

This commit is contained in:
2026-08-05 20:27:38 +02:00
parent ed9bf5f062
commit 5ca8eeeaa7
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -11,6 +11,7 @@ import json
import logging
import secrets
from datetime import date
from urllib.parse import quote_plus
from fastapi import Depends, FastAPI, Query, Request
from fastapi.responses import HTMLResponse, RedirectResponse
@@ -30,6 +31,7 @@ app = FastAPI(title="iCloud Contacts Sync Interne API", version="1.0.0")
app.add_middleware(SessionMiddleware, secret_key=secrets.token_hex(32), session_cookie="ics_session")
app.mount("/static", StaticFiles(directory="api/static"), name="static")
templates = Jinja2Templates(directory="api/templates")
templates.env.filters["urlquote"] = lambda s: quote_plus(s or "")
def _row_to_contact_out(row: dict) -> dict:
+1 -1
View File
@@ -410,7 +410,7 @@
<div class="section-title">Schnelllinks</div>
<div class="section-list">
{% for link in custom_links %}
<a href="{{ link.url | replace('[fullname]', contact.full_name or '') }}" target="_blank" class="quicklink-item">
<a href="{{ link.url | replace('[fullname]', contact.full_name | urlquote) }}" target="_blank" class="quicklink-item">
{{ link.label }}
</a>
{% endfor %}