safe_relpath. Internal helper function. This docstring was added automatically to improve maintainability. Args: p: Parameter. Returns: Varies.
(p: str)
| 3457 | links: Parameter. |
| 3458 | extras: Parameter. |
| 3459 | |
| 3460 | Returns: |
| 3461 | Varies. |
| 3462 | """ |
| 3463 | ensure_profile_row(username) |
| 3464 | conn = db_connect() |
| 3465 | |
| 3466 | # Build a safe UPDATE that only touches columns that exist (older DBs) |
| 3467 | try: |
| 3468 | cols = [r[1] for r in conn.execute("PRAGMA table_info(profiles)").fetchall()] |
| 3469 | except Exception: |
| 3470 | cols = [] |
| 3471 | |
| 3472 | set_parts = ["nickname_enc=?", "bio_enc=?", "links_enc=?"] |
| 3473 | params: List[object] = [ |
| 3474 | aesgcm_encrypt_text(nickname), |
| 3475 | aesgcm_encrypt_text(bio), |
| 3476 | aesgcm_encrypt_text(json.dumps(links, ensure_ascii=False)), |
| 3477 | ] |
| 3478 | |
| 3479 | if extras: |
| 3480 | for k, v in extras.items(): |
| 3481 | if v is None: |
| 3482 | v = "" |
| 3483 | col = PROFILE_EXTRA_MAP.get(k) |
| 3484 | if col and col in cols: |
| 3485 | set_parts.append(f"{col}=?") |
| 3486 | params.append(aesgcm_encrypt_text(str(v))) |
no outgoing calls
no test coverage detected