maint: Dependency upgrades and High backlog items (v2.11.0)
- All dependencies to current releases (97 known vulnerabilities -> 0), Python 3.14, uv pinned, requirements-test.txt, lxml/dateutil pinned - CSRF tokens on admin forms, logout and IndieAuth consent - IndieAuth client and crosspost link-card fetches via safe_get - FLASK_DEBUG/FLASK_ENV default off/production; image sets them - Foreign keys enforced on pooled connections; migration 018 removes orphans - Rate limits shared across processes (rate_limits, migration 019) - datetime.utcnow() and sqlite3 default adapters replaced - compose.yaml fixed; duplicate dev_auth.py and test.ini removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9f17e145ff
commit
75946be7b2
67 files changed
+885
-498
No files matched your search
@@ -14,7 +14,7 @@ Per developer Q&A Q8:
|
||||
import re
|
||||
import unicodedata
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
from typing import Optional, Set
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -138,7 +138,7 @@ def sanitize_slug(slug: str, allow_timestamp_fallback: bool = False) -> str:
|
||||
# Check if normalization resulted in empty slug
|
||||
if not slug and allow_timestamp_fallback:
|
||||
# Per Q8: Use timestamp-based fallback
|
||||
timestamp = datetime.utcnow().strftime('%Y%m%d-%H%M%S')
|
||||
timestamp = datetime.now(timezone.utc).replace(tzinfo=None).strftime('%Y%m%d-%H%M%S')
|
||||
slug = timestamp
|
||||
logger.warning(
|
||||
f"Slug normalization failed for input '{original_slug}' "
|
||||
@@ -268,7 +268,7 @@ def generate_timestamp_slug(
|
||||
'20251216143052-2'
|
||||
"""
|
||||
if created_at is None:
|
||||
created_at = datetime.utcnow()
|
||||
created_at = datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
|
||||
if existing_slugs is None:
|
||||
existing_slugs = set()
|
||||
@@ -340,7 +340,7 @@ def validate_and_sanitize_custom_slug(custom_slug: str, existing_slugs: Set[str]
|
||||
if not sanitized:
|
||||
# This should never happen with allow_timestamp_fallback=True
|
||||
# but handle it just in case
|
||||
timestamp = datetime.utcnow().strftime('%Y%m%d-%H%M%S')
|
||||
timestamp = datetime.now(timezone.utc).replace(tzinfo=None).strftime('%Y%m%d-%H%M%S')
|
||||
sanitized = timestamp
|
||||
logger.error(
|
||||
f"Unexpected empty slug after sanitization with fallback. "
|
||||
@@ -361,7 +361,7 @@ def validate_and_sanitize_custom_slug(custom_slug: str, existing_slugs: Set[str]
|
||||
if not validate_slug(sanitized):
|
||||
# This should rarely happen after sanitization
|
||||
# but if it does, use timestamp fallback
|
||||
timestamp = datetime.utcnow().strftime('%Y%m%d-%H%M%S')
|
||||
timestamp = datetime.now(timezone.utc).replace(tzinfo=None).strftime('%Y%m%d-%H%M%S')
|
||||
logger.warning(
|
||||
f"Slug '{sanitized}' (from '{custom_slug}') failed validation. "
|
||||
f"Using timestamp fallback: {timestamp}"
|
||||
@@ -375,7 +375,7 @@ def validate_and_sanitize_custom_slug(custom_slug: str, existing_slugs: Set[str]
|
||||
except ValueError as e:
|
||||
# This should rarely happen, but if it does, use timestamp
|
||||
# Per Q8: Never fail Micropub request
|
||||
timestamp = datetime.utcnow().strftime('%Y%m%d-%H%M%S')
|
||||
timestamp = datetime.now(timezone.utc).replace(tzinfo=None).strftime('%Y%m%d-%H%M%S')
|
||||
logger.error(
|
||||
f"Could not create unique slug from '{custom_slug}'. "
|
||||
f"Using timestamp: {timestamp}. Error: {e}"
|
||||
|
||||
Reference in new issue
Block a user