From 01196c066abadc1279543fc3ba424f1d61182d36 Mon Sep 17 00:00:00 2001 From: orohi Date: Sun, 9 Aug 2026 17:46:14 +0300 Subject: [PATCH] Bump version to v2.7.2 after migrate filename fix. --- app.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index de269bd..6600365 100644 --- a/app.py +++ b/app.py @@ -103,7 +103,7 @@ else: application_path = os.path.dirname(__file__) DATA_FILE = os.path.join(application_path, 'data.json') # legacy JSON; used only for one-shot import / export -CURRENT_VERSION = "v2.7.1" +CURRENT_VERSION = "v2.7.2" RELEASES_REPO_URL = repo_url() RELEASES_API_LATEST = api_latest_url() BIN_DIR = os.environ.get('TUNNEL_BIN_DIR', os.path.join(application_path, 'bin')) @@ -4205,13 +4205,19 @@ async def api_server_migrate_export( zip_bytes, summary = await asyncio.to_thread(_do_export) stamp = datetime.now(timezone.utc).strftime('%Y%m%dT%H%M%SZ') - safe_name = re.sub(r'[^\w.-]+', '_', server.get('name') or server.get('host') or 'server') + safe_name = _ascii_filename_component( + server.get('name') or server.get('host') or 'server', + fallback='server', + ) filename = f'amnezia-migrate-{safe_name}-{stamp}.zip' headers = { 'Content-Disposition': f'attachment; filename="{filename}"', 'X-Migrate-Users': str(summary.get('users', 0)), 'X-Migrate-Connections': str(summary.get('connections', 0)), - 'X-Migrate-Protocols': ','.join(summary.get('protocols') or []), + 'X-Migrate-Protocols': ','.join( + _ascii_filename_component(p, fallback='proto') + for p in (summary.get('protocols') or []) + ), } return StreamingResponse(io.BytesIO(zip_bytes), media_type='application/zip', headers=headers) except Exception as e: