remove not neaded safe_name and remove import of pathlib
Build and Push Docker Container / build-and-push (push) Successful in 1m20s

This commit is contained in:
2025-12-29 09:17:42 +01:00
parent 715af77a8c
commit 6930bb3a61
-6
View File
@@ -2,7 +2,6 @@ from my_modules.decoratory.header import login_required
from quart import Blueprint, request, jsonify, current_app from quart import Blueprint, request, jsonify, current_app
from datetime import datetime, timedelta, timezone from datetime import datetime, timedelta, timezone
from pathlib import Path
import aiofiles, asyncio, re import aiofiles, asyncio, re
upload_bp = Blueprint("upload_bp", __name__) upload_bp = Blueprint("upload_bp", __name__)
@@ -20,10 +19,6 @@ def iso_stamp_filename(prefix: str, ext: str) -> str:
ts = ts.replace("+00:00", "Z") ts = ts.replace("+00:00", "Z")
return f"{prefix}-{ts}.{ext}" return f"{prefix}-{ts}.{ext}"
def safe_name(name: str) -> str:
"""Restrict filename to safe ASCII subset."""
return re.sub(r"[^A-Za-z0-9._-]", "_", name)
def parse_expires(value: str | None) -> datetime | None: def parse_expires(value: str | None) -> datetime | None:
"""Parse expiration presets or ISO datetime.""" """Parse expiration presets or ISO datetime."""
if not value: if not value:
@@ -120,7 +115,6 @@ async def api_upload(user):
}.get(ctype, "bin") }.get(ctype, "bin")
fname = iso_stamp_filename("pasted", ext) fname = iso_stamp_filename("pasted", ext)
fname = safe_name(fname)
data = await read_all(uploaded) data = await read_all(uploaded)
storage_id = await current_app.convex.send_to_storage(data=data, content_type=content_type) storage_id = await current_app.convex.send_to_storage(data=data, content_type=content_type)